comparison src/main.cpp @ 742:edde9cbb2ce4

Corrected filtering of faulty finder command line parameter. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@1019 59b1889a-e5ac-428c-b0c7-476e01d41282
author thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282>
date Mon, 27 Sep 2010 06:31:23 +0000
parents 53de31f7e55b
children ac165b6ae67e
comparison
equal deleted inserted replaced
741:0b7602d246e4 742:edde9cbb2ce4
128 // Filter out -psn_0_118813 and similar parameters. 128 // Filter out -psn_0_118813 and similar parameters.
129 std::vector<char*> argList; 129 std::vector<char*> argList;
130 for ( int i = 0; i < argc; i++ ) { 130 for ( int i = 0; i < argc; i++ ) {
131 QString argString(argv[i]); 131 QString argString(argv[i]);
132 132
133 if ( argString.startsWith("-psn_") ) { 133 if ( argString.startsWith("-psn_") == false ) {
134 argList.push_back(argv[i]); 134 argList.push_back(argv[i]);
135 } 135 }
136 else { 136 else {
137 // std::cerr << std::endl << "The parameter "<< i << " is an invalid finder parameter. Parameter was " << argv[i] << std::endl; 137 // std::cerr << std::endl << "The parameter "<< i << " is an invalid finder parameter. Parameter was " << argv[i] << std::endl;
138 } 138 }
141 argv[i] = argList.at(i); 141 argv[i] = argList.at(i);
142 } 142 }
143 argc = argList.size(); 143 argc = argList.size();
144 #endif 144 #endif
145 145
146 // Wrap everything in a try block. Do this every time, 146 // Wrap everything in a try block. Do this every time,
147 // because exceptions will be thrown for problems. 147 // because exceptions will be thrown for problems.
148 try { 148 try {
149 // Define the command line object. 149 // Define the command line object.
150 TCLAP::CmdLine cmd("If -p and -s are set, -p will be used.\nGiving no parameters starts full gui without server.", ' ', "UiGUI version " PROGRAM_VERSION_STRING " " PROGRAM_REVISION); 150 TCLAP::CmdLine cmd("If -p and -s are set, -p will be used.\nGiving no parameters starts full gui without server.", ' ', "UiGUI version " PROGRAM_VERSION_STRING " " PROGRAM_REVISION);
151 cmd.setExceptionHandling(false); 151 cmd.setExceptionHandling(false);
152 152
153 // Define a value argument and add it to the command line. 153 // Define a value argument and add it to the command line.
167 cmd.add( verboselevelArg ); 167 cmd.add( verboselevelArg );
168 168
169 // Parse the args. 169 // Parse the args.
170 cmd.parse( argc, argv ); 170 cmd.parse( argc, argv );
171 171
172 // Get the value parsed by each arg. 172 // Get the value parsed by each arg.
173 file2OpenOnStart = QString::fromStdString( filenameArg.getValue() ); 173 file2OpenOnStart = QString::fromStdString( filenameArg.getValue() );
174 startAsPlugin = pluginSwitch.getValue(); 174 startAsPlugin = pluginSwitch.getValue();
175 startAsServer = serverSwitch.getValue(); 175 startAsServer = serverSwitch.getValue();
176 verboseLevel = verboselevelArg.getValue(); 176 verboseLevel = verboselevelArg.getValue();
177 } 177 }