-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix consistent log directory and config dir migration for linux #7665
base: master
Are you sure you want to change the base?
Conversation
4e6239c
to
2977634
Compare
Signed-off-by: kaikli <[email protected]>
Signed-off-by: kaikli <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please see my comments
const QStringList filesList = | ||
!Utility::isWindows() | ||
? QDir(oldDir).entryList(QDir::Files).filter(QRegularExpression("^(?!.*\\.log).*$")) | ||
: QDir(oldDir).entryList(QDir::Files); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am confused by this change
why do we need to special case windows OS ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because of the way how the configPath is created in src/libsync/configfile.cpp#L366
For Windows the whole config directory is moved to the data location. On all other platforms only the configuration is moved to the config location ($XDG_CONFIG_DIR
) and the log files remain in the data location ($XDG_DATA_DIR
).
On all other platforms the sync run logs are moved from this location at startup and then the directory is again used to write the sync run logs into. On the next start of the application the cycle begins again.
const auto defaultLogDir = QString( | ||
QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) | ||
+ QStringLiteral("/logs") | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that would create some behavior changes ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, because I find it better to place the log files into the data location ($XDG_DATA_DIR
) instead of the config location like the logpath of the sync run logs.
Currently the ./logs
directory is located in the config directory, but the sync run logs are written to the data location ($XDG_DATA_DIR
). And because this is inconsistent I changed the default log directory to the $XDG_DATA_DIR
and use the same directory for the sync run logs logPath.
On Windows the log and config directories are the same because of the way the config path in src/libsync/configfile.cpp#L366 is generated, but on all other platforms it makes more sense to keep them separated.
This should fix #7654.
I have moved to syncrun log files to the log directory and excluded log files when moving the config dir from the data path to the config path by the migration.