MCPcopy Create free account
hub / github.com/ZDoom/Raze / AppendArgsString

Method AppendArgsString

source/common/utility/m_argv.cpp:357–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355
356
357void FArgs::AppendArgsString(FString argv)
358{
359 auto file_index = Argv.Find("-file");
360 auto files_end = file_index + 1;
361
362 for (; files_end < Argv.Size() && Argv[files_end][0] != '-' && Argv[files_end][0] != '+'; ++files_end);
363
364 if(file_index == Argv.Size())
365 {
366 Argv.Push("-file");
367 }
368
369 bool inserting_file = true;
370
371 argv.StripLeftRight();
372
373 size_t i = 0;
374 size_t lastSection = 0;
375 size_t lastStart = 0;
376 char lastQuoteType = 0;
377
378 FString tmp;
379 bool has_tmp = false;
380
381 for(i = 0; i < argv.Len(); i++)
382 {
383 if(argv[i] == ' ')
384 {
385 FString arg = tmp + argv.Mid(lastSection, i - lastSection);
386
387 if(arg[0] == '-' || arg[0] == '+') inserting_file = false;
388
389 if(inserting_file)
390 {
391 Argv.Insert(files_end++, arg);
392 }
393 else if(arg.Compare("-file") == 0)
394 {
395 inserting_file = true;
396 }
397 else
398 {
399 files_end++;
400 Argv.Insert(file_index++, arg);
401 }
402
403 lastSection = i + 1;
404 tmp = "";
405 has_tmp = false;
406 for(;(i + 1) < argv.Len() && argv[i + 1] == ' '; i++, lastSection++);
407 lastStart = i + 1;
408 }
409 else if(argv[i] == '\'' || argv[i] == '"')
410 {
411 lastQuoteType = argv[i];
412 tmp += argv.Mid(lastSection, i - lastSection);
413 has_tmp = true;
414 bool wasSlash = false;

Callers

nothing calls this directly

Calls 8

StripLeftRightMethod · 0.80
LenMethod · 0.80
MidMethod · 0.80
FindMethod · 0.45
SizeMethod · 0.45
PushMethod · 0.45
InsertMethod · 0.45
CompareMethod · 0.45

Tested by

no test coverage detected