xx 2 лет назад
Родитель
Сommit
de7c1c7944
2 измененных файлов с 9 добавлено и 4 удалено
  1. 8 3
      src/module/process.cpp
  2. 1 1
      src/module/process.h

+ 8 - 3
src/module/process.cpp

@@ -69,10 +69,15 @@ sol::table module::process::list(sol::this_state s)
     return result_table;
 }
 
-size_t module::process::exist(const std::string& filepath)
+sol::table module::process::exist(const std::string& filepath, sol::this_state s)
 {
-    //if(ylib::process::exist(filepath).)
-    return 0;
+    auto list = ylib::process::exist(filepath);
+    sol::state_view lua(s);
+    sol::table result_table = lua.create_table();
+    for (size_t i = 0; i < list.size(); i++)
+        result_table[i + 1] = list[i];
+
+    return result_table;
 }
 
 bool module::process::exist_pid(size_t pid)

+ 1 - 1
src/module/process.h

@@ -35,7 +35,7 @@ namespace module
 		/// </summary>
 		/// <param name="filepath"></param>
 		/// <returns></returns>
-		static size_t exist(const std::string& filepath);
+		static sol::table exist(const std::string& filepath, sol::this_state s);
 		static bool exist_pid(size_t pid);
 		/// <summary>
 		/// 取PID路径