From 4b0926a0d297d4ce2a9b6994db89691d33828b6e Mon Sep 17 00:00:00 2001 From: donho Date: Sun, 3 Feb 2008 01:54:33 +0000 Subject: [PATCH] [BUG_FIXED] Restore working directory with no open files. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@122 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.h | 7 +++++++ PowerEditor/src/Notepad_plus.rc | 8 ++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index 45649e1bb..4e4a77cf5 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -841,6 +841,13 @@ private: if (!dir || !PathIsDirectory(dir)) { + //Non existing path, usually occurs when a new 1 file is open. + //Set working dir to Notepad++' directory to prevent directory lock. + char nppDir[MAX_PATH]; + + //wParam set to max_path in case boundary checks will ever be made. + SendMessage(_hSelf, NPPM_GETNPPDIRECTORY, (WPARAM)MAX_PATH, (LPARAM)nppDir); + ::SetCurrentDirectory(nppDir); return; } else diff --git a/PowerEditor/src/Notepad_plus.rc b/PowerEditor/src/Notepad_plus.rc index 5cb017c3d..cf190f97c 100644 --- a/PowerEditor/src/Notepad_plus.rc +++ b/PowerEditor/src/Notepad_plus.rc @@ -510,7 +510,7 @@ BEGIN CONTROL "",IDI_M30ICON,"Static",SS_OWNERDRAW,21,10,20,20 END -IDD_GOLINE DIALOGEX 26, 41, 233, 88 +IDD_GOLINE DIALOGEX 26, 41, 261, 88 STYLE DS_SETFONT | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU EXSTYLE WS_EX_TOOLWINDOW | WS_EX_WINDOWEDGE CAPTION "Go To..." @@ -521,11 +521,11 @@ BEGIN LTEXT "You are here :",ID_URHERE_STATIC,5,34,95,8,NOT WS_GROUP LTEXT "0123456789",ID_CURRLINE,100,34,45,8,NOT WS_GROUP LTEXT "You want to go :",ID_UGO_STATIC,5,50,95,8 - EDITTEXT ID_GOLINE_EDIT,100,49,45,12,ES_NUMBER + EDITTEXT ID_GOLINE_EDIT,100,49,71,12,ES_NUMBER LTEXT "You can't go further than :",ID_NOMORETHAN_STATIC,5,73,92,8,NOT WS_GROUP LTEXT "0123456789",ID_LASTLINE,99,73,45,8,NOT WS_GROUP - DEFPUSHBUTTON "&Go !",IDOK,155,47,70,14,BS_NOTIFY - PUSHBUTTON "I'm going nowhere",IDCANCEL,155,69,70,14,BS_NOTIFY + DEFPUSHBUTTON "&Go !",IDOK,181,47,70,14,BS_NOTIFY + PUSHBUTTON "I'm going nowhere",IDCANCEL,181,69,70,14,BS_NOTIFY END IDD_VALUE_DLG DIALOGEX 0, 0, 74, 17