mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-08 16:11:57 -07:00
config: Minor --config improvements, fixes (#4034)
* Follow symlink, only file, absolute path for -c * Create config file only for default paths * Skip non-file source= glob results * Check for absolute path on XDG_CONFIG_HOME As per spec, all non-absolute paths should be ignored. https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
This commit is contained in:
@@ -54,14 +54,17 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
std::string next_arg = std::next(it)->c_str();
|
||||
|
||||
if (!std::filesystem::exists(next_arg)) {
|
||||
std::cerr << "[ ERROR ] Config path '" << next_arg << "' doesn't exist!\n";
|
||||
if (std::filesystem::is_symlink(next_arg))
|
||||
next_arg = std::filesystem::read_symlink(next_arg);
|
||||
|
||||
if (!std::filesystem::is_regular_file(next_arg)) {
|
||||
std::cerr << "[ ERROR ] Config file '" << next_arg << "' doesn't exist!\n";
|
||||
help();
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
configPath = next_arg;
|
||||
configPath = std::filesystem::weakly_canonical(next_arg);
|
||||
Debug::log(LOG, "User-specified config location: '{}'", configPath);
|
||||
|
||||
it++;
|
||||
|
Reference in New Issue
Block a user