[Deskcut] Wrongly identify Desktop on Windows

evan_eveland at earthlink.net evan_eveland at earthlink.net
Fri Nov 4 08:09:32 EST 2005


The issue is with the directory_service class in Mozilla itself... Here's the code to detect the users Desktop in windows:
  
function getWinDesktop () {
  var retVal = '';
  var dirService = Components.classes['@mozilla.org/file/directory_service;1'].getService(Components.interfaces.nsIProperties);
  var winDesktop = dirService.get('DeskV', Components.interfaces.nsILocalFile);
  if (winDesktop.exists()) {
    retVal =  winDesktop.path;
  } else  {
    winDesktop = dirService.get('Favs', Components.interfaces.nsILocalFile);
    if (winDesktop.exists()) {
      retVal = winDesktop.path;
    }
  }
return retVal;

The values the directory_service knows about are defined in :
  http://lxr.mozilla.org/mozilla/source/xpcom/io/nsDirectoryServiceDefs.h

So for whatever reason, the directory_service isn't finding your desktop...

As for using the registry keys... there is an interface for it:
  http://lxr.mozilla.org/seamonkey/source/xpcom/ds/nsIWindowsRegKey.idl
.. but I have as much interest in playing with that as I do in eating my spleen...

Evan

You wrote:
--I'm using deskCut 0.5.0.1 on Windows XP. On the Directory tab in its 
--options, in File Path Options, when I select "Use Desktop" and click on 
--"Find", it identifies my desktop incorrectly. I have to select "Set 
--Directory" and browse to my desktop for it to be identified correctly.
--
--Perhaps it is because my desktop is not in the "usual" place - I use 
--C:\User\Desktop.
--
--It appears deskCut thinks the desktop must always be at 
--%USERPROFILE%\Desktop, which is not the case in Windows XP. In WinXP, 
--you can find out what your desktop is from the registry key 
--HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell 
--Folders. The value called Desktop has the absolute path to the desktop.
--
--Can you please fix this?
--
--Thanks
----
--Wiley


More information about the deskCut mailing list