Skip to content

Commit

Permalink
Fix #1031 (#1032)
Browse files Browse the repository at this point in the history
file_writer_utils.cc - fix preprocessor check and wrong path check
  • Loading branch information
ptc-tgamper authored Jan 12, 2024
1 parent 9f856ab commit 74a1435
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/draco/io/file_writer_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,10 @@ bool DirectoryExists(const std::string &path_arg) {
struct stat path_stat;
std::string path = path_arg;

#if defined(_WIN32) && not defined(__MINGW32__)
#if defined(_WIN32) && !defined(__MINGW32__)
// Avoid a silly windows issue: stat() will fail on a drive letter missing the
// trailing slash.
if (path.size() > 0 && path[path.size()] != '\\' &&
path[path.size()] != '/') {
// trailing slash. To keep it simple, append a path separator to all paths.
if (!path.empty() && path.back() != '\\' && path.back() != '/') {
path.append("\\");
}
#endif
Expand All @@ -68,9 +67,7 @@ bool CheckAndCreatePathForFile(const std::string &filename) {
const ghc::filesystem::path ghc_path(path);
ghc::filesystem::create_directories(ghc_path);
#endif // DRACO_TRANSCODER_SUPPORTED
const bool directory_exists = DirectoryExists(path);

return directory_exists;
return DirectoryExists(path);
}

} // namespace draco

0 comments on commit 74a1435

Please sign in to comment.