diff --git a/jobs.cpp b/jobs.cpp index 8d97bb5..19e533e 100644 --- a/jobs.cpp +++ b/jobs.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -276,9 +277,33 @@ std::string build_stdin_json(const std::string& job_id, if (!m.empty()) node_metadata = m; } - std::string ops_db_wsl = to_wsl_path(ops_db); - std::string app_dir_wsl = to_wsl_path(app_dir); - std::string root_wsl = to_wsl_path(registry_root); + // Resolver paths a absoluto antes del to_wsl_path. Si el ops_db + // viene relativo (caso tipico: "projects//operations.db"), + // el subprocess Python lo abriria contra su propio cwd y crearia + // un fichero vacio si no coincide. Forzar absoluto evita ese bug. + auto absify = [](const std::string& p) -> std::string { + if (p.empty()) return p; + // Normalizar backslashes a forward slashes ANTES de absolute(). + // El path puede venir mezclado (Windows fs::path::string() en + // build cross, copia desde Windows...). Sin esto, std::filesystem + // en Linux trata `\` como caracter literal del nombre. + std::string norm = p; + for (char& c : norm) if (c == '\\') c = '/'; + std::error_code ec; + std::filesystem::path fp(norm); + if (fp.is_absolute()) return norm; + auto abs = std::filesystem::absolute(fp, ec); + std::string out = ec ? norm : abs.lexically_normal().string(); + for (char& c : out) if (c == '\\') c = '/'; + return out; + }; + std::string ops_db_abs = absify(ops_db); + std::string app_dir_abs = absify(app_dir); + std::string root_abs = absify(registry_root); + + std::string ops_db_wsl = to_wsl_path(ops_db_abs); + std::string app_dir_wsl = to_wsl_path(app_dir_abs); + std::string root_wsl = to_wsl_path(root_abs); std::string cache_dir = app_dir_wsl + "/cache"; std::ostringstream o;