On Sun, 30 Nov 2008, Ambroz Bizjak wrote: [...]
To allow that, I've modified winemenubuilder to record created shortcuts to registry, and my service will obtain and maintain the list of .lnk/url files from there.
The general idea is good, but I don't think you should store these paths in the registry. Instead the daemon should ask for file change notifications for the relevant special folders (CSIDL_STARTMENU, etc) and act accordingly when a .lnk or .url file gets added / deleted somewhere in thes directories.
On Monday 01 December 2008, Francois Gouget wrote:
On Sun, 30 Nov 2008, Ambroz Bizjak wrote: [...]
To allow that, I've modified winemenubuilder to record created shortcuts to registry, and my service will obtain and maintain the list of .lnk/url files from there.
The general idea is good, but I don't think you should store these paths in the registry. Instead the daemon should ask for file change notifications for the relevant special folders (CSIDL_STARTMENU, etc) and act accordingly when a .lnk or .url file gets added / deleted somewhere in thes directories.
In that case the daemon would still have to store the list of known files, so that if a shortcut is deleted while Wine is not running, or if my service is not running at that particular time, its removal could still be detected.
Another issue with your suggestion is that it would complicate watching. Assuming the notification functions don't work everywhere, and they may have race conditions*, we still have to poll for changes - that means recursing the folders.
Last, my service does not yet remove created icons. With the current design, it is largely a matter of also recording the icon names to registry in winemenubuilder. It would be quite hard and hackish to locate the icon from the .desktop file. It would even be hard to get the logical location of the shortcut only from the location of the .lnk, because functions in menubuilder that do that require the file to exist.
* I once deleted two watched files in some folder, but only one notification was generated, and my program found only one of the files missing.