summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2016-05-15 13:52:17 +0000
committerManolo Gouy <Manolo>2016-05-15 13:52:17 +0000
commite3d96c1bcf6cecd78a510f8e78bc7e13c6b63514 (patch)
treeea1bdd4a4f5f1ebc5c6aeeef75338292b2008ea9
parent3db259007acef0067ad467ab9e434d39d9002097 (diff)
Simpler test/help.cxx under Mac OS X
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3-porting@11738 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--test/help.cxx58
1 files changed, 17 insertions, 41 deletions
diff --git a/test/help.cxx b/test/help.cxx
index 1f5a42b97..104102f06 100644
--- a/test/help.cxx
+++ b/test/help.cxx
@@ -25,26 +25,7 @@
//
#include <FL/Fl_Help_Dialog.H>
-
-
-#ifdef USING_XCODE
-#include <ApplicationServices/ApplicationServices.h>
-void set_app_dir() {
- char app_path[2048];
- CFBundleRef app = CFBundleGetMainBundle();
- CFURLRef url = CFBundleCopyBundleURL(app);
- CFStringRef cc_app_path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
- CFStringGetCString(cc_app_path, app_path, 2048, kCFStringEncodingUTF8);
- if (*app_path) {
- char *n = strrchr(app_path, '/');
- if (n) {
- *n = 0;
- chdir(app_path);
- }
- }
-}
-#endif
-
+#include <stdio.h>
//
// 'main()' - Display the help GUI...
@@ -54,43 +35,38 @@ int // O - Exit status
main(int argc, // I - Number of command-line arguments
char *argv[]) // I - Command-line arguments
{
- Fl_Help_Dialog *help; // Help dialog
-
-
- help = new Fl_Help_Dialog;
-
- int argn = 1;
-
-#ifdef USING_XCODE
+ Fl_Help_Dialog *help = new Fl_Help_Dialog;
- if (argc>argn && strncmp(argv[1], "-psn_", 5)==0) argn++;
- else if (argc>argn && strncmp(argv[1], "-NSDocumentRevisionsDebugMode", 29)==0) argn += 2;
- set_app_dir();
+#ifdef __APPLE__
- if (argc <= argn)
- help->load("../../../../test/help-test.html");
- else
- help->load(argv[argn]);
+ // 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-test.html");
+ FILE *in = fl_fopen(htmlname, "r");
+ if (in) {
+ fclose(in);
+ help->load(htmlname);
+ } else
-#else
+#endif
- if (argc <= argn)
+ if (argc <= 1)
help->load("help-test.html");
else
help->load(argv[1]);
-#endif
-
help->show(1, argv);
Fl::run();
delete help;
- return (0);
+ return 0;
}
-
//
// End of "$Id$".
//