-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
//
// See doc/authors.adoc for a complete list of contributors.
//
namespace util {
-std::string
-add_exe_suffix(const std::string& program)
+fs::path
+add_exe_suffix(const fs::path& program)
{
- return fs::path(program).has_extension() ? program : program + ".exe";
+ return program.has_extension() ? program
+ : util::with_extension(program, ".exe");
}
fs::path
-// Copyright (C) 2021-2025 Joel Rosdahl and other contributors
+// Copyright (C) 2021-2026 Joel Rosdahl and other contributors
//
// See doc/authors.adoc for a complete list of contributors.
//
// --- Interface ---
// Add ".exe" suffix to `program` if it doesn't already have an extension.
-std::string add_exe_suffix(const std::string& program);
+std::filesystem::path add_exe_suffix(const std::filesystem::path& program);
// Return a new path with `extension` added to `path` (keeping any existing
// extension).