From 210114ca0fb9e77cbcd6f30aa4188bf4f841508c Mon Sep 17 00:00:00 2001 From: Matthias Melcher Date: Tue, 4 Jan 2011 00:53:13 +0000 Subject: [PATCH] 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 --- ide/Xcode3/FLTK.xcodeproj/project.pbxproj | 12 +++++++ test/help.cxx | 42 +++++++++++++++++++++-- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/ide/Xcode3/FLTK.xcodeproj/project.pbxproj b/ide/Xcode3/FLTK.xcodeproj/project.pbxproj index 846bfb54f..c0c5a329e 100644 --- a/ide/Xcode3/FLTK.xcodeproj/project.pbxproj +++ b/ide/Xcode3/FLTK.xcodeproj/project.pbxproj @@ -502,6 +502,7 @@ C96290E61274D100007D3CFE /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C96290E51274D100007D3CFE /* OpenGL.framework */; }; C96291151274D1FD007D3CFE /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C9628FFD1274D0B3007D3CFE /* Cocoa.framework */; }; C984AFA812D02A1800D66DAD /* demo.menu in Resources */ = {isa = PBXBuildFile; fileRef = C984AFA712D02A1800D66DAD /* demo.menu */; }; + C99FD8E212D2A2AD002FC776 /* browser.cxx in CopyFiles */ = {isa = PBXBuildFile; fileRef = 6D999C03407EAEE9C4D3477A /* browser.cxx */; }; C9A374AB3AD29E141C659819 /* fltk.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = FEB0F8FE6383384180570D94 /* fltk.framework */; }; C9C4C91FDA73557BB6B69F3D /* jchuff.c in Sources */ = {isa = PBXBuildFile; fileRef = D9DB580DCA05DE487FACA272 /* jchuff.c */; }; C9D72F10B7A22DD0349ABC68 /* fltk_forms.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 097D0B476E396B9AAC6FA1E0 /* fltk_forms.framework */; }; @@ -3665,6 +3666,16 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C99FD8E112D2A295002FC776 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 7; + files = ( + C99FD8E212D2A2AD002FC776 /* browser.cxx in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; C9EDD42D1274B84100ADB21C /* CopyFiles */ = { isa = PBXCopyFilesBuildPhase; buildActionMask = 2147483647; @@ -6968,6 +6979,7 @@ FD1A7D2F7532522CCF2B0FFB /* Sources */, 5CEB6CB961822D1167C891C6 /* Frameworks */, B1608C348129813E176E8357 /* CopyFiles */, + C99FD8E112D2A295002FC776 /* CopyFiles */, ); buildRules = ( 982E85D9644C6688DAA59FCA /* PBXBuildRule */, 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();