[core] Check variant_path when updating config file (#89)

This commit is contained in:
双草酸酯 2021-02-07 03:48:51 +08:00 committed by GitHub
parent 4a96345b21
commit 5c1997f64d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View File

@ -214,12 +214,17 @@ namespace lspd {
}
fs::file_time_type ConfigManager::GetLastWriteTime() const {
auto config_path = GetConfigPath();
auto list_path = GetConfigPath("modules.list");
return std::max({path_exists<true>(config_path) ? fs::last_write_time(config_path)
: fs::file_time_type{},
path_exists<true>(list_path) ? fs::last_write_time(list_path)
: fs::file_time_type{},});
auto last_write_time = [](std::string_view path) __attribute__((always_inline)) {
return path_exists<true>(path) ? fs::last_write_time(path) : fs::file_time_type{};
};
std::string config_path = GetConfigPath();
std::string list_path = GetConfigPath("modules.list");
std::string variant_path = GetVariantPath();
return std::max({
last_write_time(config_path),
last_write_time(list_path),
last_write_time(variant_path)
});
}
bool ConfigManager::InitConfigPath() const {

View File

@ -130,8 +130,6 @@ namespace lspd {
ConfigManager(uid_t uid, bool initialized = false);
static std::unordered_set<std::string> GetAppList(const std::filesystem::path &dir);
std::string RetrieveInstallerPkgName() const;
static std::string GetPackageNameFromBaseApkPath(const std::filesystem::path &path);