mirror of
https://github.com/fltk/fltk.git
synced 2026-06-04 15:32:12 +08:00
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
This commit is contained in:
+14
-19
@@ -26,7 +26,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#include <FL/Fl_Help_Dialog.H>
|
#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...
|
// 'main()' - Display the help GUI...
|
||||||
@@ -37,27 +38,21 @@ main(int argc, // I - Number of command-line arguments
|
|||||||
char *argv[]) // I - Command-line arguments
|
char *argv[]) // I - Command-line arguments
|
||||||
{
|
{
|
||||||
Fl_Help_Dialog *help = new Fl_Help_Dialog;
|
Fl_Help_Dialog *help = new Fl_Help_Dialog;
|
||||||
|
char htmlname[FL_PATH_MAX];
|
||||||
|
if (argc > 1) {
|
||||||
|
strcpy(htmlname, argv[1]);
|
||||||
|
} else {
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
|
// bundled apps do not set the current directory
|
||||||
// bundled apps do not set the current directory
|
strcpy(htmlname, argv[0]);
|
||||||
char htmlname[1000];
|
char *slash = strrchr(htmlname, '/');
|
||||||
strcpy(htmlname, argv[0]);
|
if (slash) strcpy(slash, "/../Resources/help_dialog.html");
|
||||||
char *slash = strrchr(htmlname, '/');
|
#else
|
||||||
if (slash)
|
strcpy(htmlname, "help_dialog.html");
|
||||||
strcpy(slash, "/../Resources/help_dialog.html");
|
|
||||||
FILE *in = fl_fopen(htmlname, "r");
|
|
||||||
if (in) {
|
|
||||||
fclose(in);
|
|
||||||
help->load(htmlname);
|
|
||||||
} else
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (argc <= 1)
|
help->load(htmlname); // TODO: add error check (when load() returns int instead of void)
|
||||||
help->load("help_dialog.html");
|
|
||||||
else
|
|
||||||
help->load(argv[1]);
|
|
||||||
|
|
||||||
help->show(1, argv);
|
help->show(1, argv);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user