32 lines
898 B
C++
32 lines
898 B
C++
#include "editor/SpineProbe.hpp"
|
|
|
|
#include <system_error>
|
|
|
|
namespace dts {
|
|
|
|
SpineProbe::SpineProbe(const IProcessRunner& processRunner)
|
|
: processRunner_(processRunner) {}
|
|
|
|
EditorProbeResult SpineProbe::inspect(
|
|
const std::filesystem::path& executable,
|
|
std::chrono::milliseconds timeout) const {
|
|
std::error_code error;
|
|
if (!std::filesystem::is_regular_file(executable, error)) {
|
|
EditorProbeResult result;
|
|
result.executable = executable;
|
|
result.status = EditorProbeStatus::PathMissing;
|
|
result.message = "Spine executable does not exist.";
|
|
return result;
|
|
}
|
|
|
|
ProcessRequest request;
|
|
request.program = executable;
|
|
request.arguments = {"--version"};
|
|
request.workingDirectory = executable.parent_path();
|
|
request.timeout = timeout;
|
|
return parser_.parse(executable, processRunner_.run(request));
|
|
}
|
|
|
|
} // namespace dts
|
|
|