diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 2f25071d7..3b436310e 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -4677,14 +4677,14 @@ void Notepad_plus::loadCommandlineParams(const TCHAR * commandLine, CmdLineParam LangType lt = pCmdParams->_langType; int ln = pCmdParams->_line2go; int cn = pCmdParams->_column2go; - + bool recursive = pCmdParams->_isRecursive; bool readOnly = pCmdParams->_isReadOnly; BufferID lastOpened = BUFFER_INVALID; for (int i = 0, len = fnss.size(); i < len ; ++i) { pFn = fnss.getFileName(i); - BufferID bufID = doOpen(pFn, readOnly); + BufferID bufID = doOpen(pFn, recursive, readOnly); if (bufID == BUFFER_INVALID) //cannot open file continue; diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index dbc30b5f2..4fd870ade 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -220,7 +220,7 @@ public: // fileOperations //The doXXX functions apply to a single buffer and dont need to worry about views, with the excpetion of doClose, since closing one view doesnt have to mean the document is gone - BufferID doOpen(const TCHAR *fileName, bool isReadOnly = false, int encoding = -1); + BufferID doOpen(const TCHAR *fileName, bool isRecursive = false, bool isReadOnly = false, int encoding = -1); bool doReload(BufferID id, bool alert = true); bool doSave(BufferID, const TCHAR * filename, bool isSaveCopy = false); void doClose(BufferID, int whichOne); diff --git a/PowerEditor/src/NppIO.cpp b/PowerEditor/src/NppIO.cpp index 0a1b5aaf9..778601579 100644 --- a/PowerEditor/src/NppIO.cpp +++ b/PowerEditor/src/NppIO.cpp @@ -35,7 +35,7 @@ #include -BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encoding) +BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isRecursive, bool isReadOnly, int encoding) { NppParameters *pNppParam = NppParameters::getInstance(); TCHAR longFileName[MAX_PATH]; @@ -191,7 +191,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi patterns.push_back(substring + 1); generic_string dir(fileName, pos + 1); - getMatchedFileNames(dir.c_str(), patterns, fileNames, true, false); + getMatchedFileNames(dir.c_str(), patterns, fileNames, isRecursive, false); } else { @@ -1111,7 +1111,7 @@ bool Notepad_plus::loadSession(Session & session) } if (PathFileExists(pFn)) { - lastOpened = doOpen(pFn, false, session._mainViewFiles[i]._encoding); + lastOpened = doOpen(pFn, false, false, session._mainViewFiles[i]._encoding); } else { @@ -1194,7 +1194,7 @@ bool Notepad_plus::loadSession(Session & session) } if (PathFileExists(pFn)) { - lastOpened = doOpen(pFn, false, session._subViewFiles[k]._encoding); + lastOpened = doOpen(pFn, false, false, session._subViewFiles[k]._encoding); //check if already open in main. If so, clone if (_mainDocTab.getIndexByBuffer(lastOpened) != -1) { diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h index f7d647012..a079766b9 100644 --- a/PowerEditor/src/Parameters.h +++ b/PowerEditor/src/Parameters.h @@ -177,7 +177,6 @@ struct CmdLineParams { bool _isPreLaunch; bool _showLoadingTime; bool _alwaysOnTop; - int _line2go; int _column2go; @@ -188,6 +187,7 @@ struct CmdLineParams { return _isPointXValid && _isPointYValid; }; bool _isSessionFile; + bool _isRecursive; LangType _langType; generic_string _localizationPath; diff --git a/PowerEditor/src/winmain.cpp b/PowerEditor/src/winmain.cpp index 22c00e7cc..2740635f9 100644 --- a/PowerEditor/src/winmain.cpp +++ b/PowerEditor/src/winmain.cpp @@ -188,10 +188,11 @@ const TCHAR FLAG_LOADINGTIME[] = TEXT("-loadingTime"); const TCHAR FLAG_HELP[] = TEXT("--help"); const TCHAR FLAG_ALWAYS_ON_TOP[] = TEXT("-alwaysOnTop"); const TCHAR FLAG_OPENSESSIONFILE[] = TEXT("-openSession"); +const TCHAR FLAG_RECURSIVE[] = TEXT("-r"); const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\ \r\ -notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [fullFilePathName]\r\ +notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-xPos] [-yPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [fullFilePathName]\r\ \r\ --help : This help message\r\ -multiInst : Launch another Notepad++ instance\r\ @@ -211,7 +212,9 @@ notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNum -loadingTime : Display Notepad++ loading time\r\ -alwaysOnTop : Make Notepad++ always on top\r\ -openSession : Open a specific session. fullFilePathName must be a session file\r\ - fullFilePathName : file name to open (absolute or relative path name)\r\ + -r : Open files recursively. This argument will be ignored\r\ + if fullFilePathName contain no wildcard character\r\ + fullFilePathName : file or folder name to open (absolute or relative path name)\r\ "); void doException(Notepad_plus_Window & notepad_plus_plus); @@ -243,6 +246,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) cmdLineParams._alwaysOnTop = isInList(FLAG_ALWAYS_ON_TOP, params); cmdLineParams._showLoadingTime = isInList(FLAG_LOADINGTIME, params); cmdLineParams._isSessionFile = isInList(FLAG_OPENSESSIONFILE, params); + cmdLineParams._isRecursive = isInList(FLAG_RECURSIVE, params); cmdLineParams._langType = getLangTypeFromParam(params); cmdLineParams._localizationPath = getLocalizationPathFromParam(params); cmdLineParams._line2go = getNumberFromParam('n', params, isParamePresent);