From 6df786bea95702c5986d31c47901ad7fefea85d0 Mon Sep 17 00:00:00 2001 From: John Bytheway <52664+jbytheway@users.noreply.github.com> Date: Mon, 13 Mar 2023 16:32:20 -0400 Subject: [PATCH] Work around VS2019 filesystem issue --- src/filesystem.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/filesystem.cpp b/src/filesystem.cpp index e498da37363f6..429995ffa77d3 100644 --- a/src/filesystem.cpp +++ b/src/filesystem.cpp @@ -21,6 +21,15 @@ bool assure_dir_exist( const std::string &path ) { + // TEMPORARY until we drop VS2019 support + // VS2019 std::filesystem doesn't handle trailing slashes well in this + // situation. We think this is a bug. Work around it by removing the + // trailing slash if present. + if( string_ends_with( path, "/" ) ) { + std::string p = path; + p.pop_back(); + return assure_dir_exist( fs::u8path( p ) ); + } return assure_dir_exist( fs::u8path( path ) ); }