29 lines
924 B
C++
29 lines
924 B
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace connector {
|
|
|
|
struct ProcessResult {
|
|
int exit_code = -1;
|
|
bool timed_out = false;
|
|
std::string output;
|
|
};
|
|
|
|
// 构造 filesystem::path 时优先按 UTF-8 解释,若输入不是合法 UTF-8(例如
|
|
// Windows 环境变量里按系统代码页编码的中文路径)则回退到本地代码页构造,
|
|
// 避免 u8path 抛出 conversion_error 导致未捕获异常使程序崩溃。
|
|
std::filesystem::path to_path(const std::string& value);
|
|
|
|
std::string platform_name();
|
|
std::string find_spine_executable();
|
|
bool valid_spine_executable(const std::string& path);
|
|
ProcessResult run_process(const std::string& executable,
|
|
const std::vector<std::string>& arguments,
|
|
const std::filesystem::path& working_directory,
|
|
int timeout_seconds);
|
|
|
|
} // namespace connector
|