mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
keymap: Unveil path, if one is given
This commit is contained in:
parent
0e3408d4d6
commit
2617279579
Notes:
sideshowbarker
2024-07-18 22:40:13 +09:00
Author: https://github.com/BenWiederhake
Commit: 2617279579
Pull-request: https://github.com/SerenityOS/serenity/pull/5192
Reviewed-by: https://github.com/awesomekling
Reviewed-by: https://github.com/bcoles
Reviewed-by: https://github.com/emanuele6
Reviewed-by: https://github.com/linusg
1 changed files with 11 additions and 6 deletions
|
@ -42,17 +42,22 @@ int main(int argc, char** argv)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unveil(nullptr, nullptr) < 0) {
|
|
||||||
perror("unveil");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* path = nullptr;
|
const char* path = nullptr;
|
||||||
Core::ArgsParser args_parser;
|
Core::ArgsParser args_parser;
|
||||||
args_parser.add_positional_argument(path, "The mapping file to be used", "file", Core::ArgsParser::Required::No);
|
args_parser.add_positional_argument(path, "The mapping file to be used", "file", Core::ArgsParser::Required::No);
|
||||||
args_parser.parse(argc, argv);
|
args_parser.parse(argc, argv);
|
||||||
|
|
||||||
dbgln("path is at {:p}, and contains {}", path, path);
|
if (path && path[0] == '/') {
|
||||||
|
if (unveil(path, "r") < 0) {
|
||||||
|
perror("unveil path");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unveil(nullptr, nullptr) < 0) {
|
||||||
|
perror("unveil");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
auto keymap = Keyboard::CharacterMap::fetch_system_map();
|
auto keymap = Keyboard::CharacterMap::fetch_system_map();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue