From 210114ca0fb9e77cbcd6f30aa4188bf4f841508c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Tue, 4 Jan 2011 00:53:13 +0000 Subject: 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 --- test/help.cxx | 42 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) (limited to 'test') 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 +#ifdef USING_XCODE +#include +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(); -- cgit v1.2.3