diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index a5e813139..4d898e5dc 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -1348,6 +1348,7 @@ You can re-activate this dialog in Preferences dialog later." />
+
getFullPathName());
fDlg.setDefFileName(buf->getFileName());
+
+ generic_string title = _nativeLangSpeaker.getLocalizedStrFromID("file-rename-title", TEXT("Rename"));
+ fDlg.setTitle(title.c_str());
+
generic_string fn = fDlg.doSaveDlg();
if (!fn.empty())
@@ -1769,10 +1773,10 @@ bool Notepad_plus::fileRename(BufferID id)
// Reserved characters: < > : " / \ | ? *
std::wstring reservedChars = TEXT("<>:\"/\\|\?*");
- generic_string title = _nativeLangSpeaker.getLocalizedStrFromID("tabrename-title", TEXT("Rename Current Tab"));
generic_string staticName = _nativeLangSpeaker.getLocalizedStrFromID("tabrename-newname", TEXT("New Name: "));
StringDlg strDlg;
+ generic_string title = _nativeLangSpeaker.getLocalizedStrFromID("tabrename-title", TEXT("Rename Current Tab"));
strDlg.init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), title.c_str(), staticName.c_str(), buf->getFileName(), 0, reservedChars.c_str(), true);
TCHAR *tabNewName = reinterpret_cast(strDlg.doDialog());
diff --git a/PowerEditor/src/WinControls/OpenSaveFileDialog/CustomFileDialog.cpp b/PowerEditor/src/WinControls/OpenSaveFileDialog/CustomFileDialog.cpp
index c809dbc1d..20c5c4fbd 100644
--- a/PowerEditor/src/WinControls/OpenSaveFileDialog/CustomFileDialog.cpp
+++ b/PowerEditor/src/WinControls/OpenSaveFileDialog/CustomFileDialog.cpp
@@ -137,15 +137,21 @@ namespace // anonymous
return result;
}
- bool setDialogFolder(IFileDialog* dialog, const TCHAR* folder)
+ bool setDialogFolder(IFileDialog* dialog, const TCHAR* path)
{
- IShellItem* psi = nullptr;
- HRESULT hr = SHCreateItemFromParsingName(folder,
- 0,
- IID_IShellItem,
- reinterpret_cast(&psi));
+ com_ptr shellItem;
+ HRESULT hr = SHCreateItemFromParsingName(path,
+ nullptr,
+ IID_PPV_ARGS(&shellItem));
+ if (SUCCEEDED(hr) && shellItem && !::PathIsDirectory(path))
+ {
+ com_ptr parentItem;
+ hr = shellItem->GetParent(&parentItem);
+ if (SUCCEEDED(hr))
+ shellItem = parentItem;
+ }
if (SUCCEEDED(hr))
- hr = dialog->SetFolder(psi);
+ hr = dialog->SetFolder(shellItem);
return SUCCEEDED(hr);
}
@@ -738,7 +744,7 @@ public:
okPressed = SUCCEEDED(hr);
NppParameters& params = NppParameters::getInstance();
- if (params.getNppGUI()._openSaveDir == dir_last)
+ if (okPressed && params.getNppGUI()._openSaveDir == dir_last)
{
// Note: IFileDialog doesn't modify the current directory.
// At least, after it is hidden, the current directory is the same as before it was shown.