enh(core): define a sane default for log file path
Description
Currently, the log file is created in the current directory, which can be unpredictable and unreliable, especially when using a shortcut or a system path to launch the application. The idea is to use by default the user home directory or something else, but predictable.
Proposal
- Modify
sightrun
to use, by default:- on Linux, the value pointed by XDG_CACHE_HOME /
<profile>
- on Windows, the same path as the parameters (the one returned by
core::tools::os::getUserDataDir("sight", <profile>, true);
On). - If the log file cannot be created here, try with
std::filesystem::temp_directory_path()/<profile>
.
- on Linux, the value pointed by XDG_CACHE_HOME /
- Display the full path of the log at start (for now, only the log file name is displayed)
Functional specifications
Nothing should change, beside the default path of the log file..
Technical specifications
Nothing should change, beside the default path of the log file..
Anyway, since the name of the profile / application is needed to compute the default log path, we need to pre-parse the profile.xml. ProfileReader::createProfile
may need a split, so we don't do thing twice...
Test plan
- Launch an application without any parameter on Linux and Windows. Verify that the log is created at the predicted place.
- Verify if the log is correctly placed, for all user, with or without administrator rights
- Verify that you can still choose a specific path (via --log-output )