diff --git a/test/help_dialog.cxx b/test/help_dialog.cxx
index e2bc8f837ae45979e1bdeb627830b275a5c6e846..5fc2dc2c40de79c8f5f8bf4b009c8da5ce8a4617 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)