From a36d36d0150b02a1274cb6fb3919a6c87d920643 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Fri, 12 Mar 2010 20:25:30 +0000 Subject: [PATCH] universal binaries on Mac, some cleanup, fix for click on Mac bundle for starting llcon --- llcon.pro | 1 + src/global.h | 2 +- src/main.cpp | 15 +++++++++------ 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/llcon.pro b/llcon.pro index 0f6cbdf8..54f9011d 100755 --- a/llcon.pro +++ b/llcon.pro @@ -15,6 +15,7 @@ macx { HEADERS += mac/sound.h SOURCES += mac/sound.cpp RC_FILE = mac/llcon.icns + CONFIG += x86 ppc LIBS += -framework CoreFoundation \ -framework CoreServices \ diff --git a/src/global.h b/src/global.h index 4ba8636e..063d1754 100755 --- a/src/global.h +++ b/src/global.h @@ -220,7 +220,7 @@ public: /* Prototypes for global functions ********************************************/ // command line parsing, TODO do not declare functions globally but in a class std::string UsageArguments ( char** argv ); -bool GetFlagArgument ( int argc, char** argv, int& i, std::string strShortOpt, std::string strLongOpt ); +bool GetFlagArgument ( char** argv, int& i, std::string strShortOpt, std::string strLongOpt ); bool GetStringArgument ( int argc, char** argv, int& i, std::string strShortOpt, std::string strLongOpt, std::string& strArg ); bool GetNumericArgument ( int argc, char** argv, int& i, std::string strShortOpt, std::string strLongOpt, double rRangeStart, double rRangeStop, double& rValue); diff --git a/src/main.cpp b/src/main.cpp index ad9f491b..21f2d8c9 100755 --- a/src/main.cpp +++ b/src/main.cpp @@ -62,7 +62,7 @@ int main ( int argc, char** argv ) for ( int i = 1; i < argc; i++ ) { // server mode flag ---------------------------------------------------- - if ( GetFlagArgument ( argc, argv, i, "-s", "--server" ) ) + if ( GetFlagArgument ( argv, i, "-s", "--server" ) ) { bIsClient = false; cout << "- server mode chosen" << std::endl; @@ -71,7 +71,7 @@ int main ( int argc, char** argv ) // use GUI flag -------------------------------------------------------- - if ( GetFlagArgument ( argc, argv, i, "-n", "--nogui" ) ) + if ( GetFlagArgument ( argv, i, "-n", "--nogui" ) ) { bUseGUI = false; cout << "- no GUI mode chosen" << std::endl; @@ -80,7 +80,7 @@ int main ( int argc, char** argv ) // disable LEDs flag --------------------------------------------------- - if ( GetFlagArgument ( argc, argv, i, "-d", "--disableleds" ) ) + if ( GetFlagArgument ( argv, i, "-d", "--disableleds" ) ) { bDisalbeLEDs = true; cout << "- disable LEDs in main window" << std::endl; @@ -142,7 +142,7 @@ int main ( int argc, char** argv ) // connect on startup -------------------------------------------------- - if ( GetFlagArgument ( argc, argv, i, "-c", "--connect" ) ) + if ( GetFlagArgument ( argv, i, "-c", "--connect" ) ) { bConnectOnStartup = true; cout << "- connect on startup enabled" << std::endl; @@ -164,7 +164,11 @@ int main ( int argc, char** argv ) cerr << "Unknown option '" << argv[i] << "' -- use '--help' for help" << endl; +// clicking on the Mac application bundle, the actual application +// is called with weird command line args -> do not exit on these +#if !( defined ( __APPLE__ ) || defined ( __MACOSX ) ) exit ( 1 ); +#endif } // Application object @@ -317,8 +321,7 @@ std::string UsageArguments ( char **argv ) "Example: " + std::string ( argv[0] ) + " -l -inifile myinifile.ini\n"; } -bool GetFlagArgument ( int argc, - char** argv, +bool GetFlagArgument ( char** argv, int& i, std::string strShortOpt, std::string strLongOpt )