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
This commit is contained in:
harrybharry 2008-10-21 16:16:24 +00:00
parent f033f1a8e7
commit 15afe60aea
2 changed files with 3 additions and 2 deletions

View File

@ -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];

View File

@ -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);