diff options
| author | Matthias Melcher <fltk@matthiasm.com> | 2011-01-04 00:53:13 +0000 |
|---|---|---|
| committer | Matthias Melcher <fltk@matthiasm.com> | 2011-01-04 00:53:13 +0000 |
| commit | 210114ca0fb9e77cbcd6f30aa4188bf4f841508c (patch) | |
| tree | fea93eb846f564ccd03eab844045f9ad67c1d6a8 /test | |
| parent | d4d4a24eff2fdba0a1a3744c31962f88ffca5db4 (diff) | |
test/help now finds some documentation. This kind of works, but since we decided to load a sample page instead, I will have to improve this... .
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@8176 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test')
| -rw-r--r-- | test/help.cxx | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/test/help.cxx b/test/help.cxx index 95aabdcd0..aca3eeff8 100644 --- a/test/help.cxx +++ b/test/help.cxx @@ -36,6 +36,25 @@ #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 + + // // 'main()' - Display the help GUI... // @@ -49,11 +68,28 @@ main(int argc, // I - Number of command-line arguments help = new Fl_Help_Dialog; - if (argc < 2) - help->load("../documentation/html/main.html"); + int argn = 1; + +#ifdef USING_XCODE + + if (argc>argn && strncmp(argv[1], "-psn_", 5)==0) + argn++; + set_app_dir(); + + if (argc <= argn) + help->load("../../../../documentation/html/intro.html"); + else + help->load(argv[argn]); + +#else + + if (argc <= argn) + help->load("../documentation/html/intro.html"); else help->load(argv[1]); - + +#endif + help->show(1, argv); Fl::run(); |
