summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/help_dialog.cxx14
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)