Skip to content
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

Store configuration files in a subdirectory #175

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions HowToBuild.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ $ ln -s ../../quickviewer/QuickViewer/translations translations

### For Windows

- **[database]**
- **[config/database]** or **[database]**
- SQLite database which contains Catalogs and thumbnails
- **[shaders]**
- Fragment Shaders for image resizing (obsolete)
Expand All @@ -132,11 +132,16 @@ $ ln -s ../../quickviewer/QuickViewer/translations translations
- Application main
- **AssociateFilesWithQuickViewer.exe**
- Set the association of image formats with UAC
- **quickviewer.ini**
- **[config/quickviewer.ini]** or **[quickviewer.ini]**
- Main configuration file. Includes keyboard and mouse settings
- **progress.ini**
- **[config/progress.ini]** or **[progress.ini]**
- Record the last displayed image in volume.

The versions with **config** subdirectory are preferred due to their
better security properties - the directory may be made writable without
allowing modifications to the binary files. However, since they break
compatibility with current installations, they are only used if the
directory exists.

### For Linux (.AppImage)

Expand Down
4 changes: 4 additions & 0 deletions QuickViewer/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ int main(int argc, char *argv[])
// it must be set to the QT_QPA_PLATFORM environment variable before that.
# ifdef QV_PORTABLE
QString inipath = QDir::toNativeSeparators(QFileInfo(argv[0]).path());
QDir iniSubDir = QDir(inipath + "\\" CONFIG_SUBDIR);
if (iniSubDir.exists()) {
inipath += "\\" CONFIG_SUBDIR;
}
inipath += "\\" APP_INI;
# else
QString inipath = QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)).filePath(APP_INI);
Expand Down
4 changes: 4 additions & 0 deletions QuickViewer/src/models/qvapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ QString QVApplication::getFilePathOfApplicationSetting(QString subFilePath)
{
#ifdef Q_OS_WIN
if(m_portable) {
QDir settingsSubDir = getApplicationFilePath(QString("%1/" CONFIG_SUBDIR).arg(subFilePath));
if (settingsSubDir.exists()) {
return settingsSubDir;
}
return getApplicationFilePath(subFilePath);
} else {
return QDir(QStandardPaths::writableLocation(QStandardPaths::DataLocation)).filePath(subFilePath);
Expand Down
1 change: 1 addition & 0 deletions QuickViewer/src/qv_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define QV_THUMBNAILS "thumbnail.sqlite3.db"

#ifdef Q_OS_WIN
#define CONFIG_SUBDIR "config"
#define APP_INI "quickviewer.ini"
#define PROGRESS_INI "progress.ini"
#define LINEFEED "\r\n"
Expand Down