Pārlūkot izejas kodu

UE: Use Vector<String> for the command-line arguments

Core::ArgsParser gained support for String a while ago. So let's use
that.
Gunnar Beutner 4 gadi atpakaļ
vecāks
revīzija
26e711f953
1 mainītis faili ar 4 papildinājumiem un 9 dzēšanām
  1. 4 9
      Userland/DevTools/UserspaceEmulator/main.cpp

+ 4 - 9
Userland/DevTools/UserspaceEmulator/main.cpp

@@ -19,27 +19,22 @@ bool g_report_to_debug = false;
 
 
 int main(int argc, char** argv, char** env)
 int main(int argc, char** argv, char** env)
 {
 {
-    Vector<const char*> command;
+    Vector<String> arguments;
 
 
     Core::ArgsParser parser;
     Core::ArgsParser parser;
     parser.add_option(g_report_to_debug, "Write reports to the debug log", "report-to-debug", 0);
     parser.add_option(g_report_to_debug, "Write reports to the debug log", "report-to-debug", 0);
-    parser.add_positional_argument(command, "Command to emulate", "command");
+    parser.add_positional_argument(arguments, "Command to emulate", "command");
     parser.parse(argc, argv);
     parser.parse(argc, argv);
 
 
-    auto executable_path = Core::find_executable_in_path(command[0]);
+    auto executable_path = Core::find_executable_in_path(arguments[0]);
     if (executable_path.is_empty()) {
     if (executable_path.is_empty()) {
-        executable_path = Core::File::real_path_for(command[0]);
+        executable_path = Core::File::real_path_for(arguments[0]);
         if (executable_path.is_empty()) {
         if (executable_path.is_empty()) {
             reportln("Cannot find executable for '{}'.", executable_path);
             reportln("Cannot find executable for '{}'.", executable_path);
             return 1;
             return 1;
         }
         }
     }
     }
 
 
-    Vector<String> arguments;
-    for (auto arg : command) {
-        arguments.append(arg);
-    }
-
     Vector<String> environment;
     Vector<String> environment;
     for (int i = 0; env[i]; ++i) {
     for (int i = 0; env[i]; ++i) {
         environment.append(env[i]);
         environment.append(env[i]);