Opened 10 years ago

Closed 10 years ago

#268 closed defect (fixed)

.desktop files not parsed correctly

Reported by: Nathan Rennie-Waldock Owned by: Antoine gmail
Priority: major Milestone:
Component: Server Keywords:
Cc:

Description

.desktop files aren't being parsed correctly. Thunderbird is showing incorrectly as "Contacts". It appears only the last section is being processed, not the Desktop Entry section.

Attachments (1)

thunderbird.desktop (9.8 KB) - added by Nathan Rennie-Waldock 10 years ago.

Download all attachments as: .zip

Change History (5)

Changed 10 years ago by Nathan Rennie-Waldock

Attachment: thunderbird.desktop added

comment:1 Changed 10 years ago by Antoine gmail

Owner: set to Antoine gmail
Status: newaccepted

Yeah, you're right, I think the easiest thing to do is to just parse the first one and stop there.

comment:2 Changed 10 years ago by Nathan Rennie-Waldock

That should work. The alternative would be to use ConfigParser? to parse just the Desktop Entry section.

>>> from ConfigParser import ConfigParser
>>> config = ConfigParser()
>>> config.read("/usr/share/applications/thunderbird.desktop")
['/usr/share/applications/thunderbird.desktop']
>>> config.sections()
['Desktop Entry', 'Desktop Action Compose', 'Desktop Action Contacts']
>>> config.get("Desktop Entry", "Name")
'Thunderbird Mail'
>>> config.get("Desktop Entry", "Exec")
'thunderbird %u'
>>> config.get("Desktop Entry", "Icon")
'thunderbird'

comment:3 Changed 10 years ago by Antoine gmail

If I had been aware of ConfigParser when I wrote this code... we wouldn't have this problem!
Oh well, r5297 should fix this.

comment:4 Changed 10 years ago by Nathan Rennie-Waldock

Resolution: fixed
Status: acceptedclosed

Yep, that's working properly now. Thanks

Note: See TracTickets for help on using tickets.