mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-11-13 20:25:53 +08:00
[fix] reject empty and relative XDG storage paths
This commit is contained in:
1 parent
ac8eff5099
commit
24f91c608a
2 files changed
+4
-2
No files matched your search
@@ -17,7 +17,8 @@ std::filesystem::path Home() {
|
||||
std::filesystem::path EnvOrDefault(const char* name,
|
||||
const std::filesystem::path& fallback) {
|
||||
const char* value = std::getenv(name);
|
||||
return value ? std::filesystem::path(value) : fallback;
|
||||
const std::filesystem::path path = value ? value : "";
|
||||
return path.is_absolute() ? path : fallback;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -16,7 +16,8 @@ std::filesystem::path Home() {
|
||||
std::filesystem::path EnvOrDefault(const char* name,
|
||||
const std::filesystem::path& fallback) {
|
||||
const char* value = std::getenv(name);
|
||||
return value ? std::filesystem::path(value) : fallback;
|
||||
const std::filesystem::path path = value ? value : "";
|
||||
return path.is_absolute() ? path : fallback;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Reference in new issue
Block a user