diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index e85b5988f..6f7414ff3 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -220,11 +220,16 @@ void Notepad_plus::init(HINSTANCE hInst, HWND parent, const char *cmdLine, CmdLi if (cmdLine) { + char currPath[MAX_PATH]; + ::GetCurrentDirectory(sizeof currPath, currPath); + ::SetCurrentDirectory(currPath); + LangType lt = cmdLineParams->_langType; int ln = cmdLineParams->_line2go; if (PathFileExists(cmdLine)) { + doOpen(cmdLine, cmdLineParams->_isReadOnly); if (lt != L_TXT) @@ -417,13 +422,26 @@ bool Notepad_plus::doOpen(const char *fileName, bool isReadOnly) if (!PathFileExists(longFileName)) { - char str2display[128]; - sprintf(str2display, "%s doesn't exist. Create it?", longFileName); + char str2display[MAX_PATH*2]; + char longFileDir[MAX_PATH]; + + strcpy(longFileDir, longFileName); + PathRemoveFileSpec(longFileDir); - if (::MessageBox(_hSelf, str2display, "Create new file", MB_YESNO) == IDYES) + if (PathFileExists(longFileDir)) { - FILE *f = fopen(longFileName, "w"); - fclose(f); + sprintf(str2display, "%s doesn't exist. Create it?", longFileName); + + if (::MessageBox(_hSelf, str2display, "Create new file", MB_YESNO) == IDYES) + { + FILE *f = fopen(longFileName, "w"); + fclose(f); + } + else + { + _lastRecentFileList.remove(longFileName); + return false; + } } else { diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp index 96cdf086f..b17ec1671 100644 --- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp +++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp @@ -641,7 +641,7 @@ BOOL CALLBACK DefaultNewDocDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM for (int i = L_TXT ; i < L_END ; i++) { string str; - //if ((LangType)i != L_END) + if ((LangType)i != L_USER) { int cmdID = pNppParam->langTypeToCommandID((LangType)i); if ((cmdID != -1) && (getNameStrFromCmd(cmdID, str) == TYPE_CMD)) diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 6508d145b..1524da9f9 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -200,7 +200,6 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdSh cmdLineParams._isNoPlugin = isInList(FLAG_NO_PLUGIN, lpszCmdLine); cmdLineParams._isReadOnly = isInList(FLAG_READONLY, lpszCmdLine); cmdLineParams._isNoSession = isInList(FLAG_NOSESSION, lpszCmdLine); - //printStr(cmdLineParams._isReadOnly?"RO":"RW"); cmdLineParams._langType = getLangTypeFromParam(lpszCmdLine); cmdLineParams._line2go = getLn2GoFromParam(lpszCmdLine);