diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index 4ba7d1d93..21be19e51 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -2671,6 +2671,15 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa return TRUE; } + case NPPM_INTERNAL_REFRESHWORKDIR: + { + const Buffer* buf = _pEditView->getCurrentBuffer(); + generic_string path = buf ? buf->getFullPathName() : _T(""); + PathRemoveFileSpec(path); + setWorkingDir(path.c_str()); + return TRUE; + } + default: { if (message == WDN_NOTIFY) diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index c628886b8..760716b0e 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -2148,6 +2148,7 @@ INT_PTR CALLBACK DefaultDirectorySubDlg::run_dlgProc(UINT message, WPARAM wParam { case IDC_OPENSAVEDIR_FOLLOWCURRENT_RADIO: nppGUI._openSaveDir = dir_followCurrent; + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_REFRESHWORKDIR, 0, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT), false); ::EnableWindow(::GetDlgItem(_hSelf, IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON), false); return TRUE; @@ -2158,6 +2159,7 @@ INT_PTR CALLBACK DefaultDirectorySubDlg::run_dlgProc(UINT message, WPARAM wParam return TRUE; case IDC_OPENSAVEDIR_ALWAYSON_RADIO: nppGUI._openSaveDir = dir_userDef; + ::SendMessage(::GetParent(_hParent), NPPM_INTERNAL_REFRESHWORKDIR, 0, 0); ::EnableWindow(::GetDlgItem(_hSelf, IDC_OPENSAVEDIR_ALWAYSON_EDIT), true); ::EnableWindow(::GetDlgItem(_hSelf, IDD_OPENSAVEDIR_ALWAYSON_BROWSE_BUTTON), true); return TRUE; diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index e6e583c53..c70e9d811 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -632,6 +632,7 @@ #define NPPM_INTERNAL_UPDATETEXTZONEPADDING (NOTEPADPLUS_USER_INTERNAL + 58) #define NPPM_INTERNAL_REFRESHDARKMODE (NOTEPADPLUS_USER_INTERNAL + 59) #define NPPM_INTERNAL_SCINTILLAFINDERCOPYPATHS (NOTEPADPLUS_USER_INTERNAL + 60) + #define NPPM_INTERNAL_REFRESHWORKDIR (NOTEPADPLUS_USER_INTERNAL + 61) // See Notepad_plus_msgs.h //#define NOTEPADPLUS_USER (WM_USER + 1000)