diff options
| author | Greg Ercolano <erco@seriss.com> | 2017-11-19 01:18:16 +0000 |
|---|---|---|
| committer | Greg Ercolano <erco@seriss.com> | 2017-11-19 01:18:16 +0000 |
| commit | 310c545179793cdb59dba73ce5080c1ebd62f0b1 (patch) | |
| tree | 0c1391615d490cf64d1990e270f1499e3834c27d /test | |
| parent | a877466a214f5d38d433554b1a8f0783b7814789 (diff) | |
Fixes STR#3428: allows command line to specify alternate html file on Mac platform
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12568 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
| -rw-r--r-- | test/help_dialog.cxx | 37 |
1 files changed, 16 insertions, 21 deletions
diff --git a/test/help_dialog.cxx b/test/help_dialog.cxx index 03f697e8f..e2bc8f837 100644 --- a/test/help_dialog.cxx +++ b/test/help_dialog.cxx @@ -26,7 +26,8 @@ // #include <FL/Fl_Help_Dialog.H> -#include <stdio.h> +#include <FL/filename.H> /* FL_PATH_MAX */ +#include <string.h> /* strcpy(), etc */ // // 'main()' - Display the help GUI... @@ -37,28 +38,22 @@ 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]; + if (argc > 1) { + strcpy(htmlname, argv[1]); + } else { #ifdef __APPLE__ - - // bundled apps do not set the current directory - char htmlname[1000]; - strcpy(htmlname, argv[0]); - char *slash = strrchr(htmlname, '/'); - if (slash) - strcpy(slash, "/../Resources/help_dialog.html"); - FILE *in = fl_fopen(htmlname, "r"); - if (in) { - fclose(in); - help->load(htmlname); - } 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 + strcpy(htmlname, "help_dialog.html"); #endif - - if (argc <= 1) - help->load("help_dialog.html"); - else - help->load(argv[1]); - + } + + help->load(htmlname); // TODO: add error check (when load() returns int instead of void) + help->show(1, argv); Fl::run(); |
