#pragma once #include #include #include 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); // 查询/释放连接器固定使用的本地端口。释放操作针对当前监听进程, // 使用户可以从新打开的连接器窗口停止遗留实例或其他占用者。 bool connector_port_in_use(); bool stop_connector_port(std::string& error); ProcessResult run_process(const std::string& executable, const std::vector& arguments, const std::filesystem::path& working_directory, int timeout_seconds); } // namespace connector