Skip to content

Commit

Permalink
refactor(cli,ipc): platform specific navigator mounts
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Nov 3, 2023
1 parent 6dceac4 commit e415e66
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
16 changes: 15 additions & 1 deletion src/cli/cli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5697,7 +5697,21 @@ int main (const int argc, const char* argv[]) {

for (const auto& tuple : settings) {
if (tuple.first.starts_with("webview_navigator_mounts_")) {
const auto key = replace(tuple.first, "webview_navigator_mounts_", "");
const auto key = replace(
replace(tuple.first, "webview_navigator_mounts_", ""),
"mac_",
""
);

if (
key.starts_with("android") ||
key.starts_with("ios") ||
key.starts_with("linux") ||
key.starts_with("win")
) {
continue;
}

if (key.starts_with("$HOST_HOME") || key.starts_with("~")) {
const auto path = replace(replace(key, "$HOST_HOME", ""), "~", "");
entitlementSettings["configured_entitlements"] += (
Expand Down
15 changes: 14 additions & 1 deletion src/ipc/bridge.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3520,7 +3520,20 @@ namespace SSC::IPC {

for (const auto& tuple : userConfig) {
if (tuple.first.starts_with("webview_navigator_mounts_")) {
const auto key = replace(tuple.first, "webview_navigator_mounts_", "");
auto key = replace(tuple.first, "webview_navigator_mounts_", "");

if (key.starts_with("android") && !platform.android) continue;
if (key.starts_with("ios") && !platform.ios) continue;
if (key.starts_with("linux") && !platform.linux) continue;
if (key.starts_with("mac") && !platform.mac) continue;
if (key.starts_with("win") && !platform.win) continue;

key = replace(key, "android_", "");
key = replace(key, "ios_", "");
key = replace(key, "linux_", "");
key = replace(key, "mac_", "");
key = replace(key, "win_", "");

const auto path = replace(replace(key, "$HOST_HOME", ""), "~", HOME);
const auto& value = tuple.second;
mounts.insert_or_assign(path, value);
Expand Down

0 comments on commit e415e66

Please sign in to comment.