2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #5181 from Morph1984/5174-review

common/file_util: Address review comments of #5174
This commit is contained in:
bunnei 2020-12-10 15:52:11 -08:00 committed by GitHub
commit cdb36aef9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,16 +136,10 @@ bool CreateDirs(const fs::path& path) {
bool CreateFullPath(const fs::path& path) {
LOG_TRACE(Common_Filesystem, "path {}", path);
// Removes trailing slashes and turns any '\' into '/'
const auto new_path = SanitizePath(path.string(), DirectorySeparator::ForwardSlash);
if (new_path.rfind('.') == std::string::npos) {
// The path is a directory
return CreateDirs(new_path);
if (path.has_extension()) {
return CreateDirs(path.parent_path());
} else {
// The path is a file
// Creates directory preceding the last '/'
return CreateDirs(new_path.substr(0, new_path.rfind('/')));
return CreateDirs(path);
}
}