From b06d6e36468c10864fefc33a4627e4ded36faae3 Mon Sep 17 00:00:00 2001 From: Morph <39850852+Morph1984@users.noreply.github.com> Date: Wed, 9 Dec 2020 05:05:32 -0500 Subject: [PATCH] vfs_real: Fix CreateFile for files without a file extension --- src/core/file_sys/vfs_real.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/core/file_sys/vfs_real.cpp b/src/core/file_sys/vfs_real.cpp index 488687ba9..3b70f7755 100644 --- a/src/core/file_sys/vfs_real.cpp +++ b/src/core/file_sys/vfs_real.cpp @@ -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; }