diff --git a/src/libutil/filesystem.cpp b/src/libutil/filesystem.cpp index f4b2a27f73..27a2bfa2dd 100644 --- a/src/libutil/filesystem.cpp +++ b/src/libutil/filesystem.cpp @@ -523,7 +523,11 @@ Filesystem::unique_path(string_view model) for (size_t i = 0, e = modelStr.size(); i < e; ++i) if (name[i] == '%') name[i] = chrs[pick(rg)]; +# if defined(_WIN32) + if (!exists(Strutil::utf16_to_utf8(name))) +# else if (!exists(name)) +# endif break; } # if defined(_WIN32)