changeset 733:fe50761a234f

Ensure correct command line parsing on Mac, because when opened with Finder, a curious argument starting with ^ will be added. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1010 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Tue, 07 Sep 2010 07:17:38 +0000
parents 3ee67782b40a
children 53de31f7e55b
files src/tclap/CmdLine.h
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/tclap/CmdLine.h	Sun May 30 13:27:37 2010 +0000
+++ b/src/tclap/CmdLine.h	Tue Sep 07 07:17:38 2010 +0000
@@ -458,6 +458,15 @@
 			if ( !matched && _emptyCombined( args[i] ) )
 				matched = true;
 
+#ifdef __APPLE__
+			// If we are running on Mac, opening an app with the finder
+			// adds a command line arg like this: -^G^Gn_0_516222.
+			// To avoid a CmdLineParseException set matched to true if
+			// the arg begines with ^.
+			if ( !matched && args[i].at(0) == '^' )
+				matched = true;
+#endif
+
 			if ( !matched && !Arg::ignoreRest() )
 				throw(CmdLineParseException("Couldn't find match "
 											"for argument",