Minesweeper+Snake: load config file before calling unveil()

This commit is contained in:
Brendan Coles 2020-11-04 11:49:50 +00:00 committed by Andreas Kling
parent 0603402c80
commit e558f6b184
Notes: sideshowbarker 2024-07-19 01:33:38 +09:00
3 changed files with 12 additions and 4 deletions

View file

@ -0,0 +1,8 @@
[Minesweeper]
SingleChording=0
[Game]
MineCount=10
Columns=9
Rows=9

View file

@ -53,13 +53,13 @@ int main(int argc, char** argv)
return 1;
}
auto config = Core::ConfigFile::get_for_app("Minesweeper");
if (unveil("/res", "r") < 0) {
perror("unveil");
return 1;
}
auto config = Core::ConfigFile::get_for_app("Minesweeper");
if (unveil(config->file_name().characters(), "crw") < 0) {
perror("unveil");
return 1;

View file

@ -51,13 +51,13 @@ int main(int argc, char** argv)
return 1;
}
auto config = Core::ConfigFile::get_for_app("Snake");
if (unveil("/res", "r") < 0) {
perror("unveil");
return 1;
}
auto config = Core::ConfigFile::get_for_app("Snake");
if (unveil(config->file_name().characters(), "crw") < 0) {
perror("unveil");
return 1;