From 15afe60aea8aa9f025e2613559d685354aee5aee Mon Sep 17 00:00:00 2001 From: harrybharry Date: Tue, 21 Oct 2008 16:16:24 +0000 Subject: [PATCH] Fix bug with opening relative path files (delay initial SetCurrentDirectory call) git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@344 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Parameters.cpp | 1 - PowerEditor/src/winmain.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index df955458..e8aaaeba 100644 --- a/PowerEditor/src/Parameters.cpp +++ b/PowerEditor/src/Parameters.cpp @@ -442,7 +442,6 @@ NppParameters::NppParameters() : _pXmlDoc(NULL),_pXmlUserDoc(NULL), _pXmlUserSty //Initialize current directory to startup directory ::GetCurrentDirectory(MAX_PATH, _currentDirectory); - ::SetCurrentDirectory(_nppPath); //force working directory to path of module, preventing lock _appdataNppDir[0] = '\0'; TCHAR notepadStylePath[MAX_PATH]; diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index f15b7645..a8268fa0 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -162,7 +162,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh const TCHAR * currentFile; TCHAR fullFileName[MAX_PATH]; - //TODO: try merging the flenames and see if it exists, user may have typed a single spaced filename without quotes for(size_t i = 0; i < nrFilesToOpen; i++) { currentFile = params.at(i); @@ -181,6 +180,9 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh quotFileName += TEXT("\" "); } + //Only after loading all the file paths set the working directory + ::SetCurrentDirectory(NppParameters::getInstance()->getNppPath()); //force working directory to path of module, preventing lock + if ((!isMultiInst) && (!TheFirstOne)) { HWND hNotepad_plus = ::FindWindow(Notepad_plus::getClassName(), NULL);