mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-08-15 23:46:00 +08:00
file_writer_utils.cc - fix preprocessor check and wrong path check
This commit is contained in:
parent
9f856abaaf
commit
74a1435eed
@ -38,11 +38,10 @@ bool DirectoryExists(const std::string &path_arg) {
|
|||||||
struct stat path_stat;
|
struct stat path_stat;
|
||||||
std::string path = path_arg;
|
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
|
// Avoid a silly windows issue: stat() will fail on a drive letter missing the
|
||||||
// trailing slash.
|
// trailing slash. To keep it simple, append a path separator to all paths.
|
||||||
if (path.size() > 0 && path[path.size()] != '\\' &&
|
if (!path.empty() && path.back() != '\\' && path.back() != '/') {
|
||||||
path[path.size()] != '/') {
|
|
||||||
path.append("\\");
|
path.append("\\");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -68,9 +67,7 @@ bool CheckAndCreatePathForFile(const std::string &filename) {
|
|||||||
const ghc::filesystem::path ghc_path(path);
|
const ghc::filesystem::path ghc_path(path);
|
||||||
ghc::filesystem::create_directories(ghc_path);
|
ghc::filesystem::create_directories(ghc_path);
|
||||||
#endif // DRACO_TRANSCODER_SUPPORTED
|
#endif // DRACO_TRANSCODER_SUPPORTED
|
||||||
const bool directory_exists = DirectoryExists(path);
|
return DirectoryExists(path);
|
||||||
|
|
||||||
return directory_exists;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace draco
|
} // namespace draco
|
||||||
|
Loading…
x
Reference in New Issue
Block a user