summaryrefslogtreecommitdiff
path: root/test/demo.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2012-12-05 14:53:03 +0000
committerManolo Gouy <Manolo>2012-12-05 14:53:03 +0000
commit598e2cb63be08386f1440b010c19c8c9c7eb178e (patch)
tree34f742da3c2e7607062b81ad2bba3eda7c26786a /test/demo.cxx
parent4b6613cbd22f4a2853e1aac07ac906bc0a11c96c (diff)
MacOS: create a bundled version of all example programs with fltk-config --post
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9736 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/demo.cxx')
-rw-r--r--test/demo.cxx20
1 files changed, 15 insertions, 5 deletions
diff --git a/test/demo.cxx b/test/demo.cxx
index 371822ff5..f15167bbf 100644
--- a/test/demo.cxx
+++ b/test/demo.cxx
@@ -27,7 +27,7 @@
# define chdir _chdir
# define putenv _putenv
# endif // !__WATCOMC__
-#elif defined USING_XCODE
+#elif defined __APPLE__
#include <ApplicationServices/ApplicationServices.h>
#include <unistd.h> // for chdir()
#include <stdio.h>
@@ -272,7 +272,7 @@ void dobut(Fl_Widget *, long arg)
delete[] command;
delete[] copy_of_icommand;
-#elif defined USING_XCODE
+#elif defined __APPLE__
char *cmd = strdup(menus[men].icommand[bn]);
char *arg = strchr(cmd, ' ');
@@ -283,22 +283,32 @@ void dobut(Fl_Widget *, long arg)
CFBundleRef app = CFBundleGetMainBundle();
CFURLRef url = CFBundleCopyBundleURL(app);
CFStringRef cc_app_path = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
+ CFRelease(url);
CFStringGetCString(cc_app_path, app_path, 2048, kCFStringEncodingUTF8);
+ CFRelease(cc_app_path);
if (*app_path) {
char *n = strrchr(app_path, '/');
if (n) {
+#if defined USING_XCODE
*n = 0;
+#endif
chdir(app_path);
}
}
if (arg) {
+ const char *fluidpath;
*arg = 0;
+#if defined USING_XCODE
+ fl_filename_absolute(path, 2048, "../../../../test/");
+ fluidpath = "Fluid.app";
+#else
+ strcpy(path, app_path); strcat(path, "/");
+ fluidpath = "../fluid/fluid.app";
+#endif
if (strcmp(cmd, "../fluid/fluid")==0) {
- fl_filename_absolute(path, 2048, "../../../../test/");
- sprintf(command, "open Fluid.app --args %s%s", path, arg+1);
+ sprintf(command, "open %s --args %s%s", fluidpath, path, arg+1);
} else {
- fl_filename_absolute(path, 2048, "../../../../test/");
sprintf(command, "open %s.app --args %s%s", cmd, path, arg+1);
}
} else {