mirror of
https://github.com/hyprwm/Hyprland
synced 2025-02-18 13:02:09 +01:00
config: Use canonical instead of read_symlink (#4136)
This commit is contained in:
parent
ba2af6f86d
commit
934112af5b
1 changed files with 8 additions and 6 deletions
14
src/main.cpp
14
src/main.cpp
|
@ -52,19 +52,21 @@ int main(int argc, char** argv) {
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
std::string next_arg = std::next(it)->c_str();
|
configPath = std::next(it)->c_str();
|
||||||
|
|
||||||
if (std::filesystem::is_symlink(next_arg))
|
try {
|
||||||
next_arg = std::filesystem::read_symlink(next_arg);
|
configPath = std::filesystem::canonical(configPath);
|
||||||
|
|
||||||
if (!std::filesystem::is_regular_file(next_arg)) {
|
if (!std::filesystem::is_regular_file(configPath)) {
|
||||||
std::cerr << "[ ERROR ] Config file '" << next_arg << "' doesn't exist!\n";
|
throw std::exception();
|
||||||
|
}
|
||||||
|
} catch (...) {
|
||||||
|
std::cerr << "[ ERROR ] Config file '" << configPath << "' doesn't exist!\n";
|
||||||
help();
|
help();
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
configPath = std::filesystem::weakly_canonical(next_arg);
|
|
||||||
Debug::log(LOG, "User-specified config location: '{}'", configPath);
|
Debug::log(LOG, "User-specified config location: '{}'", configPath);
|
||||||
|
|
||||||
it++;
|
it++;
|
||||||
|
|
Loading…
Add table
Reference in a new issue