diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-08-21 18:54:40 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-08-21 18:54:40 +0200 |
| commit | d91160a9e06bd4ee341ca93509dbce9393d9168a (patch) | |
| tree | 5fa6e3fb9483ce06f39ba638790eb58d81c13129 /test/help_dialog.cxx | |
| parent | f3005a44f87e30792acc410125113cd19b76a81a (diff) | |
Remove platform specific code from test apps
Test programs that open files don't use platform specific code.
They don't open files from macOS bundles.
Support files must either be in the current working directory or
given on the command line.
On macOS this requires a full path when using bundles.
Diffstat (limited to 'test/help_dialog.cxx')
| -rw-r--r-- | test/help_dialog.cxx | 24 |
1 files changed, 4 insertions, 20 deletions
diff --git a/test/help_dialog.cxx b/test/help_dialog.cxx index 2ee19c41a..5970792bb 100644 --- a/test/help_dialog.cxx +++ b/test/help_dialog.cxx @@ -36,27 +36,11 @@ main(int argc, // I - Number of command-line arguments char *argv[]) // I - Command-line arguments { Fl_Help_Dialog *help = new Fl_Help_Dialog; - char htmlname[FL_PATH_MAX]; -#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 + int i; + if (!Fl::args(argc, argv, i)) Fl::fatal(Fl::help); + const char *fname = (i < argc) ? argv[i] : "help_dialog.html"; - help->load(htmlname); // TODO: add error check (when load() returns int instead of void) + help->load(fname); // TODO: add error check (when load() returns int instead of void) help->show(1, argv); |
