[BUG_FIXED] Fix a bug while command argument is empty ("").

[NEW_FEATURE] Warn user while the amount of file to open is larger than 200.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@904 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-05-01 12:20:18 +00:00
parent 024c82e880
commit 1697b664b1
2 changed files with 32 additions and 13 deletions

View File

@ -190,9 +190,25 @@ BufferID Notepad_plus::doOpen(const TCHAR *fileName, bool isReadOnly, int encodi
fileNameStr += TEXT("\\");
getMatchedFileNames(fileNameStr.c_str(), patterns, fileNames, true, false);
for (size_t i = 0 ; i < fileNames.size() ; i++)
size_t nbFiles2Open = fileNames.size();
bool ok2Open = true;
if (nbFiles2Open > 200)
{
doOpen(fileNames[i].c_str());
int answer = _nativeLangSpeaker.messageBox("NbFileToOpenImportantWaring",
_pPublicInterface->getHSelf(),
TEXT("Number of files to open are too important.\rAre you sure to open them?"),
TEXT("Number of files to open is too large"),
MB_YESNO|MB_APPLMODAL);
ok2Open = answer != IDYES;
}
if (ok2Open)
{
for (size_t i = 0 ; i < nbFiles2Open ; i++)
{
doOpen(fileNames[i].c_str());
}
}
}
else

View File

@ -244,19 +244,22 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int)
for(size_t i = 0; i < nrFilesToOpen; i++)
{
currentFile = params.at(i);
//check if relative or full path. Relative paths dont have a colon for driveletter
BOOL isRelative = ::PathIsRelative(currentFile);
quotFileName += TEXT("\"");
if (isRelative)
if (currentFile[0])
{
::GetFullPathName(currentFile, MAX_PATH, fullFileName, NULL);
quotFileName += fullFileName;
//check if relative or full path. Relative paths dont have a colon for driveletter
BOOL isRelative = ::PathIsRelative(currentFile);
quotFileName += TEXT("\"");
if (isRelative)
{
::GetFullPathName(currentFile, MAX_PATH, fullFileName, NULL);
quotFileName += fullFileName;
}
else
{
quotFileName += currentFile;
}
quotFileName += TEXT("\" ");
}
else
{
quotFileName += currentFile;
}
quotFileName += TEXT("\" ");
}
//Only after loading all the file paths set the working directory