[BUG_FIXED] Fix open session on another instance while session to open path contain space.
[ENHANCEMENT] open session always on the same instance if no files opened in this instance. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1087 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
e89c5b9dfb
commit
bc17d47825
@ -1228,16 +1228,28 @@ bool Notepad_plus::fileLoadSession(const TCHAR *fn)
|
|||||||
sessionFileName = fn;
|
sessionFileName = fn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NppParameters *pNppParam = NppParameters::getInstance();
|
NppParameters *pNppParam = NppParameters::getInstance();
|
||||||
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
const NppGUI & nppGUI = pNppParam->getNppGUI();
|
||||||
if (sessionFileName)
|
if (sessionFileName)
|
||||||
{
|
{
|
||||||
if ((nppGUI._multiInstSetting == multiInstOnSession || nppGUI._multiInstSetting == multiInst))
|
bool isEmptyNpp = false;
|
||||||
|
if (_mainDocTab.nbItem() == 1 && _subDocTab.nbItem() == 1)
|
||||||
|
{
|
||||||
|
Buffer * buf1 = MainFileManager->getBufferByID(_mainDocTab.getBufferByIndex(0));
|
||||||
|
Buffer * buf2 = MainFileManager->getBufferByID(_subDocTab.getBufferByIndex(0));
|
||||||
|
isEmptyNpp = (!buf1->isDirty() && buf1->isUntitled() && !buf2->isDirty() && buf2->isUntitled());
|
||||||
|
}
|
||||||
|
if (!isEmptyNpp && (nppGUI._multiInstSetting == multiInstOnSession || nppGUI._multiInstSetting == multiInst))
|
||||||
{
|
{
|
||||||
TCHAR nppFullPath[MAX_PATH];
|
TCHAR nppFullPath[MAX_PATH];
|
||||||
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
|
::GetModuleFileName(NULL, nppFullPath, MAX_PATH);
|
||||||
|
|
||||||
|
|
||||||
generic_string args = TEXT("-multiInst -nosession -openSession ");
|
generic_string args = TEXT("-multiInst -nosession -openSession ");
|
||||||
|
args += TEXT("\"");
|
||||||
args += sessionFileName;
|
args += sessionFileName;
|
||||||
|
args += TEXT("\"");
|
||||||
::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
|
::ShellExecute(_pPublicInterface->getHSelf(), TEXT("open"), nppFullPath, args.c_str(), TEXT("."), SW_SHOW);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user