MUtilities development repository
修订版 | 415d385f86d8e41309936d0bd7a1f30432787dc5 (tree) |
---|---|
时间 | 2015-10-17 21:01:42 |
作者 | ![]() |
Commiter | LoRd_MuldeR |
Fixed MUtils::OS::arguments() function. Regression in 44add70b7ca0c549f442981501b71439d4372aaf.
@@ -119,20 +119,24 @@ const MUtils::OS::ArgumentMap &MUtils::OS::arguments(void) | ||
119 | 119 | } |
120 | 120 | |
121 | 121 | g_arguments_list.reset(new ArgumentMap()); |
122 | - int nArgs = 0; | |
123 | 122 | const QStringList argList = crack_command_line(); |
124 | 123 | |
125 | - if(argList.count() > 1) | |
124 | + if(!argList.isEmpty()) | |
126 | 125 | { |
127 | 126 | const QString argPrefix = QLatin1String("--"); |
128 | - const QChar separator = QLatin1Char('='); | |
127 | + const QChar separator = QLatin1Char('='); | |
129 | 128 | |
130 | - for(int i = 1; i < nArgs; i++) | |
129 | + bool firstToken = true; | |
130 | + for(QStringList::ConstIterator iter = argList.constBegin(); iter != argList.constEnd(); iter++) | |
131 | 131 | { |
132 | - const QString &argStr = argList[i]; | |
133 | - if(argStr.startsWith(argPrefix)) | |
132 | + if(firstToken) | |
133 | + { | |
134 | + firstToken = false; | |
135 | + continue; /*skip executable file name*/ | |
136 | + } | |
137 | + if(iter->startsWith(argPrefix)) | |
134 | 138 | { |
135 | - const QString argData = argStr.mid(2).trimmed(); | |
139 | + const QString argData = iter->mid(2).trimmed(); | |
136 | 140 | if(argData.length() > 0) |
137 | 141 | { |
138 | 142 | const int separatorIndex = argData.indexOf(separator); |