#28 restore sessions based on work dir

Next_major_release
closed
nobody
None
5
2015-01-25
2007-08-20
Schwabix
No

A little improvement to allow automatic session restore based on the working dir (for those commandline-die-hards).

Besides the source change below you need to save a session file ONCE with the name "session.xml" to the directory that is your project directory. After that, every time you start N++ via command prompt from this directory or from a shortcut setting this as a working directory, N++ will use this session file instead of the global one. If the current directory does not contain a session.xml N++ behaves as before.

In Parameters.cpp (v4.2.2):

bool NppParameters::load(/*bool noUserPath*/)
{
...

//----------------------------//
// session.xml : for per user //
//----------------------------//

#define SESSION_PER_DIR // this line should go to BOF

#ifdef SESSION_PER_DIR
GetCurrentDirectory(sizeof _sessionPath,_sessionPath);
PathAppend(_sessionPath, "session.xml");

if (! PathFileExists(_sessionPath)) {
strcpy(_sessionPath, userPath);
PathAppend(_sessionPath, "session.xml");
}
#else
// original code
strcpy(_sessionPath, userPath);
PathAppend(_sessionPath, "session.xml");
#endif

_pXmlSessionDoc = new TiXmlDocument(_sessionPath);
loadOkay = _pXmlSessionDoc->LoadFile();
...
}

Please le me know whether you find this change useful OR if you find any issues with it.

Schwabix, markus@kuhn-clan.de

Discussion

  • Schwabix

    Schwabix - 2007-08-20
    • summary: restore session files based on work dir --> restore sessions based on work dir
     
  • Don HO

    Don HO - 2014-08-17
    • status: open --> closed
    • Group: --> Next_major_release
     
    • Schwabix

      Schwabix - 2014-08-18

      Wow, could it be you are slightly lagging?

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks