[bad] Open command executes EXE instead of opening folder

Found a bug in SpaceMonger? Report it here!

[bad] Open command executes EXE instead of opening folder

Postby Peter Ritchie on Thu Aug 23, 2007 5:15 pm

If there is an executable in a folder and there is a folder with the same root name as that exe when you to open (right-click Open or Ctrl+O) with SpaceMonger it will execute that EXE instead of opening the folder.

Steps to reproduce.
Create a folder named test on the root of drive C:
Copy c:\windows\notepad.exe to the root of drive C: and rename to test.exe
Start SpaceMonger.
Right click the test folder and select Open.
Notepad is executed.

...fortunately I didn't find this with an EXE that destroys any data.
Peter Ritchie
 
Posts: 5
Joined: Sat Aug 11, 2007 11:21 am

Postby Spire on Thu Aug 23, 2007 8:31 pm

SpaceMonger is probably just calling ShellExecute() on the path "C:\test" and trusting Windows to do the right thing -- which in this case, due to the ambiguity, it doesn't. If you try to run "C:\test" via Start | Run, you'll see the same thing.

I guess SpaceMonger might be able to work around this problem by running explorer.exe directly (with the path as an argument), but that would strike me as being an inelegant and brittle kludge.
Spire
 
Posts: 57
Joined: Sat Mar 11, 2006 3:52 am

Postby Spire on Thu Aug 23, 2007 8:34 pm

Better workaround: Simply append a "\" to the path string before calling ShellExecute() (if it doesn't already end in "\").
Spire
 
Posts: 57
Joined: Sat Mar 11, 2006 3:52 am

Postby insignis on Fri Aug 22, 2008 8:15 pm

Spire wrote:Better workaround: Simply append a "" to the path string before calling ShellExecute() (if it doesn't already end in "").

If the object they right clicked on is a folder, the proper thing to do is ShellExecute with the trailing backslash, i.e. it's not a "workaround"... :)
User avatar
insignis
 
Posts: 67
Joined: Sun Feb 05, 2006 7:41 pm


Return to Bugs!

Who is online

Users browsing this forum: No registered users and 1 guest

cron