Merge pull request #5176 from Morph1984/fix-createfile

vfs_real: Fix CreateFile for files without a file extension
This commit is contained in:
Chloe 2020-12-09 22:47:03 +11:00 committed by GitHub
commit 6d6115475b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -94,9 +94,13 @@ VirtualFile RealVfsFilesystem::OpenFile(std::string_view path_, Mode perms) {
VirtualFile RealVfsFilesystem::CreateFile(std::string_view path_, Mode perms) {
const auto path = FS::SanitizePath(path_, FS::DirectorySeparator::PlatformDefault);
const auto path_fwd = FS::SanitizePath(path, FS::DirectorySeparator::ForwardSlash);
const auto parent_path = FS::GetParentPath(path);
if (!FS::Exists(path)) {
FS::CreateFullPath(path_fwd);
if (!FS::CreateDirs(parent_path)) {
return nullptr;
}
if (!FS::CreateEmptyFile(path)) {
return nullptr;
}