Page 1 of 1

Current directory fix

Posted: Sat Jan 01, 2011 2:44 pm
by twinsen
Put directory containing Explorer++.exe in the path environment variable.

From command line:
"explorer++ ." does not open the current directory.

This patch fixes that.

Re: Current directory fix

Posted: Sat Jan 01, 2011 10:40 pm
by ajs
Hi David,
patch which includes the change from twinsen. I slightly modified the code to better adhere to E++ command line parsing code. I also fix it so that it can handle the start from both drives and folders.
The patch is against commit 156 and includes all the previous patches made by me and twinsen so far.

Re: Current directory fix

Posted: Tue Jan 04, 2011 4:59 pm
by ajs
Updated patch against commit 161.
This patch includes only the changes for this function, without any another change made.

Re: Current directory fix

Posted: Sat Jan 08, 2011 8:03 pm
by ajs
Commit 163 breaks the previous patch.
I have fixed the problem and re-created a patch against commit 163.

Patch file removed from here. Updated file can be found below

Re: Current directory fix

Posted: Sat Jan 08, 2011 10:07 pm
by twinsen
Your code changes doesn't work for ".."
find was used to handle both . and .. (and ..\otherDir), not sure of the equivalent c function to use instead yet, perhaps strstr?
and maybe switch the stream for sprintf

I also have fixed an issue for some directories with spaces (eg "c:\Program Files"). They seemed to have invalid characters in the string.

I haven't had time to patch the latest revision, but this is the code I am now using in 1.2:

Code: Select all

		else
		{
			TCHAR szParsingPath[MAX_PATH];
			TCHAR szCurrentDirectory[MAX_PATH];

			GetCurrentDirectory(SIZEOF_ARRAY(szCurrentDirectory),szCurrentDirectory);

			std::wstring wPath = szPath;
			if (wPath.find(TEXT("."))==0)
			{
				std::wstringstream buffer;
				buffer << szCurrentDirectory << "\\" << wPath;
				wPath = buffer.str();
				TCHAR* tPath = W2T((wchar_t*)wPath.c_str());
				StringCchCopy(szPath, _tcslen(tPath)*sizeof(TCHAR)+1, tPath);
			}

			DecodePath(szPath,szCurrentDirectory,szParsingPath,SIZEOF_ARRAY(szParsingPath));

			StringCchCopy(TabDirectory.Dir,SIZEOF_ARRAY(TabDirectory.Dir),szParsingPath);
			g_TabDirs.push_back(TabDirectory);
		}
Example exe:
http://members.iinet.net.au/~bertdb/rya ... n_1.5.2.7z


(edit)
I converted it to use wcscspn and StringCchPrintf instead and updated it to work with v187.

Code: Select all

		else
		{
			TCHAR szParsingPath[MAX_PATH];
			TCHAR szCurrentDirectory[MAX_PATH];

			GetCurrentDirectory(SIZEOF_ARRAY(szCurrentDirectory),szCurrentDirectory);

			if (wcscspn(szPath, _T("."))==0)
			{
				TCHAR szFullPath[MAX_PATH];
				StringCchPrintf(szFullPath, SIZEOF_ARRAY(szFullPath), _T("%s\\%s"), szCurrentDirectory, szPath);
				StringCchCopy(szPath, MAX_PATH, szFullPath);
			}

			DecodePath(szPath,szCurrentDirectory,szParsingPath,SIZEOF_ARRAY(szParsingPath));
			g_TabDirs.push_back(szParsingPath);
		}

Re: Current directory fix

Posted: Sun Jan 09, 2011 1:19 pm
by ajs
twinsen wrote:Your code changes doesn't work for ".."
find was used to handle both . and .. (and ..\otherDir), not sure of the equivalent c function to use instead yet, perhaps strstr?
and maybe switch the stream for sprintf

I also have fixed an issue for some directories with spaces (eg "c:\Program Files"). They seemed to have invalid characters in the string.

I haven't had time to patch the latest revision, but this is the code I am now using in 1.2:
yes, it doesn't work for "..". I will check again and fix, possibly today.

Re: Current directory fix

Posted: Sun Jan 09, 2011 6:15 pm
by ajs
Hi David,
new patch 09 which handles starting parameters as ".", ".." and any path which starts with those strings.
Also, in Options -> Files and folders, changing the size of "show all file size in" will enable the "apply" button, without the need to change another option.

Re: Current directory fix

Posted: Sun Jan 30, 2011 10:49 pm
by David Erceg
Michael, your update to OptionsDialog.cpp is incorrect - it causes the apply button to activate when the drop down is clicked (regardless of whether the selection is changed). See WM_COMMAND within GeneralSettingsProc.

Re: Current directory fix

Posted: Mon Jan 31, 2011 12:15 am
by ajs
David Erceg wrote:Michael, your update to OptionsDialog.cpp is incorrect - it causes the apply button to activate when the drop down is clicked (regardless of whether the selection is changed). See WM_COMMAND within GeneralSettingsProc.
David,
actually that was done on purpose. The reason for that is that if the "show all file size in" option is already enable, changing the size without changing anything else would not enabled the apply button. So if somebody wants to test a different size "on the fly" (i.e. without clicking on the OK button), he needs to enable/disable another option to enable the apply button.
I agree that enabling the apply button just clicking on the drop-down is not 100% correct, but thought if was a smaller problem compare the the original one.
Anyhow I will rework the patch to enable the apply button only when a different choice is made

Re: Current directory fix

Posted: Mon Jan 31, 2011 7:11 pm
by ajs
Hi David,
I have reworked this patch following your comments.