[NEW_FEATURE] (Author: Loreia) Add widecard capacity for command line arguments.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1192 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
fd800dcf20
commit
b63c4a0f6c
|
@ -62,7 +62,7 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
||||||
if (test != BUFFER_INVALID)
|
if (test != BUFFER_INVALID)
|
||||||
{
|
{
|
||||||
//switchToFile(test);
|
//switchToFile(test);
|
||||||
//Don't switch, not responsibility of doOpen, but of caller
|
//Dont switch, not responsibility of doOpen, but of caller
|
||||||
if (_pTrayIco)
|
if (_pTrayIco)
|
||||||
{
|
{
|
||||||
if (_pTrayIco->isInTray())
|
if (_pTrayIco->isInTray())
|
||||||
|
@ -89,7 +89,8 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
||||||
isWow64Off = true;
|
isWow64Off = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!PathFileExists(longFileName))
|
bool globbing = wcsrchr(longFileName, TCHAR('*')) || wcsrchr(longFileName, TCHAR('?'));
|
||||||
|
if (!PathFileExists(longFileName) && !globbing)
|
||||||
{
|
{
|
||||||
TCHAR str2display[MAX_PATH*2];
|
TCHAR str2display[MAX_PATH*2];
|
||||||
generic_string longFileDir(longFileName);
|
generic_string longFileDir(longFileName);
|
||||||
|
@ -167,7 +168,6 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
||||||
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
::SendMessage(_pPublicInterface->getHSelf(), WM_SIZE, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PathRemoveFileSpec(longFileName);
|
PathRemoveFileSpec(longFileName);
|
||||||
_linkTriggered = true;
|
_linkTriggered = true;
|
||||||
_isFileOpening = false;
|
_isFileOpening = false;
|
||||||
|
@ -180,29 +180,40 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (::PathIsDirectory(fileName))
|
if (globbing || ::PathIsDirectory(fileName))
|
||||||
{
|
{
|
||||||
vector<generic_string> fileNames;
|
vector<generic_string> fileNames;
|
||||||
vector<generic_string> patterns;
|
vector<generic_string> patterns;
|
||||||
patterns.push_back(TEXT("*.*"));
|
if (globbing)
|
||||||
|
{
|
||||||
|
const TCHAR * substring = wcsrchr(fileName, TCHAR('\\'));
|
||||||
|
size_t pos = substring - fileName;
|
||||||
|
|
||||||
|
patterns.push_back(substring + 1);
|
||||||
|
generic_string dir(fileName, pos + 1);
|
||||||
|
getMatchedFileNames(dir.c_str(), patterns, fileNames, true, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
generic_string fileNameStr = fileName;
|
generic_string fileNameStr = fileName;
|
||||||
if (fileName[lstrlen(fileName) - 1] != '\\')
|
if (fileName[lstrlen(fileName) - 1] != '\\')
|
||||||
fileNameStr += TEXT("\\");
|
fileNameStr += TEXT("\\");
|
||||||
|
|
||||||
|
patterns.push_back(TEXT("*"));
|
||||||
getMatchedFileNames(fileNameStr.c_str(), patterns, fileNames, true, false);
|
getMatchedFileNames(fileNameStr.c_str(), patterns, fileNames, true, false);
|
||||||
size_t nbFiles2Open = fileNames.size();
|
}
|
||||||
|
|
||||||
bool ok2Open = true;
|
bool ok2Open = true;
|
||||||
|
size_t nbFiles2Open = fileNames.size();
|
||||||
|
|
||||||
if (nbFiles2Open > 200)
|
if (nbFiles2Open > 200)
|
||||||
{
|
{
|
||||||
int answer = _nativeLangSpeaker.messageBox("NbFileToOpenImportantWarning",
|
ok2Open = IDYES == _nativeLangSpeaker.messageBox("NbFileToOpenImportantWarning",
|
||||||
_pPublicInterface->getHSelf(),
|
_pPublicInterface->getHSelf(),
|
||||||
TEXT("$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?"),
|
TEXT("$INT_REPLACE$ files are about to be opened.\rAre you sure to open them?"),
|
||||||
TEXT("Amount of files to open is too large"),
|
TEXT("Amount of files to open is too large"),
|
||||||
MB_YESNO|MB_APPLMODAL,
|
MB_YESNO|MB_APPLMODAL,
|
||||||
nbFiles2Open);
|
nbFiles2Open);
|
||||||
ok2Open = answer == IDYES;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ok2Open)
|
if (ok2Open)
|
||||||
|
|
Loading…
Reference in New Issue