Menu

#1982 Files specified in the command line are searched in the working directory where the application was started

KeePass_2.x
open
nobody
None
5
2015-03-22
2015-02-10
No

I usually work with two password databases.

I launch keepass2 v2.35 as "keepass2 db1.kdbx" from directory "dir1", and then if I move to a different directory and "run keypass2 db2.kdbx", keypass2 tries to find "dir1/db2.kdbx", instead of using the current directory.

This forces me to specify a full path, which is slightly inconvenient.

Discussion

  • wellread1

    wellread1 - 2015-02-11

    This is not a bug. KeePass creates a new environment that is inherited from the parent process (e.g. command processor), it does not share the parent's environment. Consequently changing the working directory in the parent process does not affect the child process (KeePass) working directory.

    However you can run separate instances (workspaces) of KeePass. Each new KeePass instance will inherit the then current working directory from the command process. To do this uncheck 'limit to singe instance' in 'Tools>Options>Advanced(tab)>Start and Exit'. Then exit KeePass. The setting will be active the next time KeePass starts.

     

    Last edit: wellread1 2015-02-11
  • Raúl Salinas-Monteagudo

    Well, keepass2 could consider the CWD and pass it on to the current instance when you call it a second time, along with the rest of parameters that are currently being sent indeed.

    I guess in ActivatePreviousInstance, the CWD could be passed when creating "IpcParamEx ipcMsg = new IpcParamEx(IpcUtilEx.CmdOpenDatabase, CommandLineArgs.SafeSerialize(vFlt), null, null, null, null);".

     
  • wellread1

    wellread1 - 2015-02-11

    The merits of one convention versus another is a topic for the discussion forum.

     
    • Raúl Salinas-Monteagudo

      Well, this is the behavior of for example Qt Creator.

      I will try to take a look at the code and see if I can make a proposal.

       
  • Dominik Reichl

    Dominik Reichl - 2015-03-22

    Ticket moved from /p/keepass/bugs/1350/

     

Log in to post a comment.