diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-07-01 11:02:46 +0200 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2020-07-01 11:02:53 +0200 |
| commit | e98d7d8df57d860058d078e085737437ed55e79e (patch) | |
| tree | 433457afa1e67057fefe7aad804b17118416b81b | |
| parent | 3b249de60a99e639704ce8dba77e593c7c07aec1 (diff) | |
Fix test/help_dialog for CMake building and macOS platform.
| -rw-r--r-- | test/help_dialog.cxx | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/test/help_dialog.cxx b/test/help_dialog.cxx index e2bc8f837..5fc2dc2c4 100644 --- a/test/help_dialog.cxx +++ b/test/help_dialog.cxx @@ -39,18 +39,24 @@ main(int argc, // I - Number of command-line arguments { Fl_Help_Dialog *help = new Fl_Help_Dialog; char htmlname[FL_PATH_MAX]; - if (argc > 1) { - strcpy(htmlname, argv[1]); - } else { #ifdef __APPLE__ + int i = 1; + while (i < argc && Fl::arg(argc, argv, i)) i++; + if (i < argc) { + strcpy(htmlname, argv[i]); + } else { // bundled apps do not set the current directory strcpy(htmlname, argv[0]); char *slash = strrchr(htmlname, '/'); if (slash) strcpy(slash, "/../Resources/help_dialog.html"); + } #else + if (argc > 1) { + strcpy(htmlname, argv[1]); + } else { strcpy(htmlname, "help_dialog.html"); -#endif } +#endif help->load(htmlname); // TODO: add error check (when load() returns int instead of void) |
