diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp index df9554584..e8aaaeba3 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 f15b7645a..a8268fa0a 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);