]> git.tdb.fi Git - libs/core.git/commitdiff
Move OS X main function to an overlay
authorMikko Rasa <tdb@tdb.fi>
Fri, 10 Oct 2014 19:59:42 +0000 (22:59 +0300)
committerMikko Rasa <tdb@tdb.fi>
Fri, 10 Oct 2014 19:59:42 +0000 (22:59 +0300)
Build
source/core/osx/main.cpp [new file with mode: 0644]
source/core/unix/main.cpp

diff --git a/Build b/Build
index 2aa78db278ab0674dfd1509fa88f91eebc803b8f..aea04a16e0a12b39f8e30d3b945cfffa058d14c6 100644 (file)
--- a/Build
+++ b/Build
@@ -38,6 +38,10 @@ package "mspcore"
                {
                        overlay "windows";
                };
+               if_arch "darwin"
+               {
+                       overlay "osx";
+               };
                if_arch "!windows"
                {
                        overlay "unix";
diff --git a/source/core/osx/main.cpp b/source/core/osx/main.cpp
new file mode 100644 (file)
index 0000000..e9a6fe2
--- /dev/null
@@ -0,0 +1,23 @@
+#include <cstring>
+#include "application.h"
+
+int main(int argc, char **argv)
+{
+       void *data = 0;
+
+       /* Applications launched from Finder get a special argument, which would
+       interfere with GetOpt.  Remove it from argv but pass it as data so it can
+       be used to determine how the application was launhed. */
+       int j = 0;
+       for(int i=0; i<argc; ++i)
+       {
+               if(!strncmp(argv[i], "-psn_", 5))
+                       data = argv[i];
+               else
+                       argv[j++] = argv[i];
+       }
+       argc = j;
+       argv[j] = 0;
+
+       return Msp::Application::run(argc, argv, data);
+}
index e7f4c3ce10b998ae4b0e3b99197807db6be08a85..434dba1b30c1f25d017897bf6925480aeaf166e0 100644 (file)
@@ -1,25 +1,6 @@
-#include <cstring>
 #include "application.h"
 
 int main(int argc, char **argv)
 {
-       void *data = 0;
-
-#ifdef __APPLE__
-       /* Applications launched from Finder get a special argument, which would
-       interfere with GetOpt.  Remove it from argv but pass it as data so it can
-       be used to determine how the application was launhed. */
-       int j = 0;
-       for(int i=0; i<argc; ++i)
-       {
-               if(!strncmp(argv[i], "-psn_", 5))
-                       data = argv[i];
-               else
-                       argv[j++] = argv[i];
-       }
-       argc = j;
-       argv[j] = 0;
-#endif
-
-       return Msp::Application::run(argc, argv, data);
+       return Msp::Application::run(argc, argv, 0);
 }