Skip to content

Commit 47cfd82

Browse files
committed
fix(config): create apps.json from default after loading file_apps cfg
Previously, would create `apps.json` if it does not exist *before* loading the config for the path it should be at. So it was always created at the default location. This is unnecessary but also confusing as an unused file is created and exists.
1 parent c9e0bb8 commit 47cfd82

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/config.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,18 +1042,6 @@ namespace config {
10421042
}
10431043

10441044
void apply_config(std::unordered_map<std::string, std::string> &&vars) {
1045-
#ifndef __ANDROID__
1046-
// TODO: Android can possibly support this
1047-
if (!fs::exists(stream.file_apps.c_str())) {
1048-
fs::copy_file(SUNSHINE_ASSETS_DIR "/apps.json", stream.file_apps);
1049-
fs::permissions(
1050-
stream.file_apps,
1051-
fs::perms::owner_read | fs::perms::owner_write,
1052-
fs::perm_options::add
1053-
);
1054-
}
1055-
#endif
1056-
10571045
for (auto &[name, val] : vars) {
10581046
BOOST_LOG(info) << "config: '"sv << name << "' = "sv << val;
10591047
modified_config_settings[name] = val;
@@ -1187,6 +1175,18 @@ namespace config {
11871175
int_between_f(vars, "wan_encryption_mode", stream.wan_encryption_mode, {0, 2});
11881176

11891177
path_f(vars, "file_apps", stream.file_apps);
1178+
#ifndef __ANDROID__
1179+
// TODO: Android can possibly support this
1180+
if (!fs::exists(stream.file_apps.c_str())) {
1181+
fs::copy_file(SUNSHINE_ASSETS_DIR "/apps.json", stream.file_apps);
1182+
fs::permissions(
1183+
stream.file_apps,
1184+
fs::perms::owner_read | fs::perms::owner_write,
1185+
fs::perm_options::add
1186+
);
1187+
}
1188+
#endif
1189+
11901190
int_between_f(vars, "fec_percentage", stream.fec_percentage, {1, 255});
11911191

11921192
map_int_int_f(vars, "keybindings"s, input.keybindings);

0 commit comments

Comments
 (0)