浏览代码

UserspaceEmulator: Allow running executables not in PATH

Brendan Coles 4 年之前
父节点
当前提交
57c96ce501
共有 1 个文件被更改,包括 6 次插入2 次删除
  1. 6 2
      Userland/DevTools/UserspaceEmulator/main.cpp

+ 6 - 2
Userland/DevTools/UserspaceEmulator/main.cpp

@@ -10,6 +10,7 @@
 #include <AK/StringBuilder.h>
 #include <LibCore/ArgsParser.h>
 #include <LibCore/DirIterator.h>
+#include <LibCore/File.h>
 #include <pthread.h>
 #include <serenity.h>
 #include <string.h>
@@ -27,8 +28,11 @@ int main(int argc, char** argv, char** env)
 
     auto executable_path = Core::find_executable_in_path(command[0]);
     if (executable_path.is_empty()) {
-        reportln("Cannot find executable for '{}'.", command[0]);
-        return 1;
+        executable_path = Core::File::real_path_for(command[0]);
+        if (executable_path.is_empty()) {
+            reportln("Cannot find executable for '{}'.", executable_path);
+            return 1;
+        }
     }
 
     Vector<String> arguments;