diff --git a/io/path.cpp b/io/path.cpp index b3fea31dd..c69d35d35 100644 --- a/io/path.cpp +++ b/io/path.cpp @@ -29,91 +29,91 @@ #include "debug.h" QString get_app_path() { - return QCoreApplication::applicationDirPath(); + return QCoreApplication::applicationDirPath(); } QDir get_app_dir() { - return QDir(get_app_path()); + return QDir(get_app_path()); } QString get_data_path() { - QDir app_dir = get_app_dir(); - if (QFileInfo::exists(app_dir.filePath("portable"))) { - return app_dir.absolutePath(); - } else { - return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); - } + QDir app_dir = get_app_dir(); + if (QFileInfo::exists(app_dir.filePath("portable"))) { + return app_dir.absolutePath(); + } else { + return QStandardPaths::writableLocation(QStandardPaths::AppDataLocation); + } } QDir get_data_dir() { - return QDir(get_data_path()); + return QDir(get_data_path()); } QString get_config_path() { - QDir app_dir = get_app_dir(); - if (QFileInfo::exists(app_dir.filePath("portable"))) { - return app_dir.absolutePath(); - } else { - return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); - } + QDir app_dir = get_app_dir(); + if (QFileInfo::exists(app_dir.filePath("portable"))) { + return app_dir.absolutePath(); + } else { + return QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation); + } } QDir get_config_dir() { - return QDir(get_config_path()); + return QDir(get_config_path()); } QList get_effects_paths() { - // returns a list of the effects paths to search + // returns a list of the effects paths to search - QList effects_paths; + QList effects_paths; - // get current app working directory - QDir app_dir = get_app_dir(); + // get current app working directory + QDir app_dir = get_app_dir(); - // "effects" subfolder in program folder - best for Windows - effects_paths.append(app_dir.filePath("effects")); + // "effects" subfolder in program folder - best for Windows + effects_paths.append(app_dir.filePath("effects")); - // "Effects" folder one level above the program's directory - best for Mac - effects_paths.append(app_dir.filePath("../Effects")); + // "Effects" folder one level above the program's directory - best for Mac + effects_paths.append(app_dir.filePath("../Effects")); - // folder in share folder - best for Linux - effects_paths.append(app_dir.filePath("/../share/olive-editor/effects")); + // folder in share folder - best for Linux + effects_paths.append(app_dir.filePath("../share/olive-editor/effects")); - // Olive will also accept a manually provided folder with an environment variable - QString env_path(qgetenv("OLIVE_EFFECTS_PATH")); - if (!env_path.isEmpty()) effects_paths.append(env_path); + // Olive will also accept a manually provided folder with an environment variable + QString env_path(qgetenv("OLIVE_EFFECTS_PATH")); + if (!env_path.isEmpty()) effects_paths.append(env_path); - return effects_paths; + return effects_paths; } QString get_file_hash(const QString& filename) { - QFileInfo file_info(filename); + QFileInfo file_info(filename); - QString cache_file = filename.mid(filename.lastIndexOf('/')+1) - + QString::number(file_info.size()) - + QString::number(file_info.lastModified().toMSecsSinceEpoch()); + QString cache_file = filename.mid(filename.lastIndexOf('/')+1) + + QString::number(file_info.size()) + + QString::number(file_info.lastModified().toMSecsSinceEpoch()); - return QCryptographicHash::hash(cache_file.toUtf8(), QCryptographicHash::Md5).toHex(); + return QCryptographicHash::hash(cache_file.toUtf8(), QCryptographicHash::Md5).toHex(); } QList get_language_paths() { - QList language_paths; + QList language_paths; - // get current app working directory - QDir app_dir = get_app_dir(); + // get current app working directory + QDir app_dir = get_app_dir(); - // subfolder in program folder - best for Windows (or compiling+running from source dir) - language_paths.append(app_dir.filePath("ts")); + // subfolder in program folder - best for Windows (or compiling+running from source dir) + language_paths.append(app_dir.filePath("ts")); - // folder one level above the program's directory - best for Mac - language_paths.append(app_dir.filePath("../Translations")); + // folder one level above the program's directory - best for Mac + language_paths.append(app_dir.filePath("../Translations")); - // folder in share folder - best for Linux - language_paths.append(app_dir.filePath("../share/olive-editor/ts")); + // folder in share folder - best for Linux + language_paths.append(app_dir.filePath("../share/olive-editor/ts")); - // Olive will also accept a manually provided folder with an environment variable - QString env_path(qgetenv("OLIVE_LANG_PATH")); - if (!env_path.isEmpty()) language_paths.append(env_path); + // Olive will also accept a manually provided folder with an environment variable + QString env_path(qgetenv("OLIVE_LANG_PATH")); + if (!env_path.isEmpty()) language_paths.append(env_path); - return language_paths; + return language_paths; }