Skip to content

Commit e558709

Browse files
committed
_webui_custom_browser_exist - macOS
1 parent b6457c8 commit e558709

File tree

1 file changed

+28
-3
lines changed

1 file changed

+28
-3
lines changed

src/webui.c

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5839,9 +5839,34 @@ static bool _webui_custom_browser_exist(_webui_window_t* win, size_t browser) {
58395839
}
58405840
}
58415841
#elif __APPLE__
5842-
// TODO: Custom browser path macOS
5843-
// `Chromium.app`...
5844-
// `Firefox.app`...
5842+
char* executable = NULL;
5843+
if (browser == Chrome) executable = "Google Chrome.app";
5844+
else if (browser == Edge) executable = "Microsoft Edge.app";
5845+
else if (browser == Epic) executable = "Epic.app";
5846+
else if (browser == Vivaldi) executable = "Vivaldi.app";
5847+
else if (browser == Brave) executable = "Brave Browser.app";
5848+
else if (browser == Firefox) executable = "Firefox.app";
5849+
else if (browser == Yandex) executable = "Yandex.app";
5850+
else if (browser == Chromium) executable = "Chromium.app";
5851+
else return false;
5852+
if (_webui_folder_exist(_webui.custom_browser_folder_path)) {
5853+
char full_app_path[(WEBUI_MAX_PATH - 2)] = {0};
5854+
WEBUI_SN_PRINTF_STATIC(
5855+
full_app_path, (WEBUI_MAX_PATH - 2),
5856+
"%s/%s", _webui.custom_browser_folder_path, executable
5857+
);
5858+
if (_webui_folder_exist(full_app_path)) {
5859+
// Create macOS command
5860+
char full_app_cmd[(WEBUI_MAX_PATH - 1)] = {0};
5861+
WEBUI_SN_PRINTF_STATIC(
5862+
full_app_cmd, (WEBUI_MAX_PATH - 1),
5863+
"open --new -a \"%s\" --args", full_app_path
5864+
);
5865+
// Browser Found
5866+
if(win) WEBUI_SN_PRINTF_DYN(win->browser_path, WEBUI_MAX_PATH, "\"%s\"", full_app_cmd);
5867+
return true;
5868+
}
5869+
}
58455870
#else
58465871
#define MAX_BROWSER_FILES (2)
58475872
char* executable = NULL;

0 commit comments

Comments
 (0)