samedi 7 mars 2015

ServerApplication cannot see file with relative path


I have an application that extends ServerApplication. Instead of relying on configuration files being in the pre-defined locations ServerApplication uses I want the user to be forced to pass the path to the file via a command line flag:


myapp -f path/to/my/file --daemon


My problem is that with the --daemon flag I cannot pass a relative path as ServerApplication cannot see the file, I need to pass a full path: /path/to/my/file. If the --daemon flag is not passed, the application is capable of seeing the file.


I know that once the application daemonizes it changes its directory to / but I'm reading the file in ApplicationServer::initialize and printing the value of application.dir shows the correct path.


Is this a bug or am I missing something?




Aucun commentaire:

Enregistrer un commentaire