|Home | Forum | Mailing List | Wiki | Snapshots | Register|
|Anonymous | Login||2017-06-25 01:49 UTC|
|My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0001771||Double Commander||File operations||public||2017-03-16 17:15||2017-03-17 20:05|
|Platform||x86-64||OS||Windows||OS Version||Windows 10|
|Product Version||0.7.8||Product Build|
|Target Version||0.8.0||Fixed in Version||0.8.0|
|Summary||0001771: Context menu commands run with wrong current directory|
|Description||When a context menu command (defined in HKEY_CLASSES_ROOT -> Folder -> shell -> (command name) -> command) is executed in Windows Explorer by right-clicking the background or a subdirectrory, it is executed with current working directory set to the directory you are currently browsing.|
In DC, it works as expected when right-clicking the background, but if right-clicking a subdirectory and running a command it is instead always run with current directory set to the DC executable's directory.
|Steps To Reproduce||Right-click a file or subdirectory and execute an action in the Windows context menu. It will get run with current working directory set to the Double Commander executable's path.|
|Additional Information||I dug around in the code a bit and found out what's causing it.|
In TShellContextMenu.PopUp, it's only setting the TCMINVOKECOMMANDINFO's lpDirectory if FBackground is true - and FBackground is only true if the user clicks the background rather than a subdirectory. So if a subdirectory is right-clicked, any commands are executed with lpDirectory unset, resulting in the current directory defaulting to Double Commander's installation path.
if FBackground then begin
lpDirectory := PAnsiChar(CeUtf8ToSys(FFiles.FullPath));
I don't know the reasoning behind doing this, but to me this behavior seems incorrect.
It seems to me like the desirable behavior should be to do the same thing Windows Explorer does, and execute the command with its working directory set to the currently browsed directory regardless of whether the background or a subdirectory is clicked.
This means that if a file or subdirectory is right-clicked, lpDirectory should be set to the item's parent directory rather than the item itself.
I have attached a patch with a change that seems to fix the problem.
|Tags||No tags attached.|
|Fixed in Revision||7456|
|Attached Files||ushellcontextmenu.pas.patch [^] (533 bytes) 2017-03-16 17:15 [Show Content]|
|2017-03-16 17:15||forbjok||New Issue|
|2017-03-16 17:15||forbjok||File Added: ushellcontextmenu.pas.patch|
|2017-03-17 20:05||Alexx2000||Fixed in Revision||=> 7456|
|2017-03-17 20:05||Alexx2000||Assigned To||=> Alexx2000|
|2017-03-17 20:05||Alexx2000||Status||new => resolved|
|2017-03-17 20:05||Alexx2000||Resolution||open => fixed|
|2017-03-17 20:05||Alexx2000||Fixed in Version||=> 0.8.0|
|2017-03-17 20:05||Alexx2000||Target Version||=> 0.8.0|
|Copyright © 2000 - 2017 MantisBT Team|