summaryrefslogtreecommitdiffstats
path: root/src/core/hle/service/filesystem
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-04-05 02:48:13 +0200
committerLioncash <mathew1800@gmail.com>2019-04-05 02:59:00 +0200
commit15e0c4c4ec112b9f37591ff5791ccca497bb85a0 (patch)
tree2ced60ae7f8cde1c4d0380e63f4025f90e66f5db /src/core/hle/service/filesystem
parentMerge pull request #2330 from lioncash/pragma (diff)
downloadyuzu-15e0c4c4ec112b9f37591ff5791ccca497bb85a0.tar
yuzu-15e0c4c4ec112b9f37591ff5791ccca497bb85a0.tar.gz
yuzu-15e0c4c4ec112b9f37591ff5791ccca497bb85a0.tar.bz2
yuzu-15e0c4c4ec112b9f37591ff5791ccca497bb85a0.tar.lz
yuzu-15e0c4c4ec112b9f37591ff5791ccca497bb85a0.tar.xz
yuzu-15e0c4c4ec112b9f37591ff5791ccca497bb85a0.tar.zst
yuzu-15e0c4c4ec112b9f37591ff5791ccca497bb85a0.zip
Diffstat (limited to 'src/core/hle/service/filesystem')
-rw-r--r--src/core/hle/service/filesystem/filesystem.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/hle/service/filesystem/filesystem.cpp b/src/core/hle/service/filesystem/filesystem.cpp
index c6da2df43..1fbab2789 100644
--- a/src/core/hle/service/filesystem/filesystem.cpp
+++ b/src/core/hle/service/filesystem/filesystem.cpp
@@ -197,13 +197,16 @@ ResultCode VfsDirectoryServiceWrapper::RenameDirectory(const std::string& src_pa
ResultVal<FileSys::VirtualFile> VfsDirectoryServiceWrapper::OpenFile(const std::string& path_,
FileSys::Mode mode) const {
- std::string path(FileUtil::SanitizePath(path_));
- auto npath = path;
- while (npath.size() > 0 && (npath[0] == '/' || npath[0] == '\\'))
- npath = npath.substr(1);
+ const std::string path(FileUtil::SanitizePath(path_));
+ std::string_view npath = path;
+ while (!npath.empty() && (npath[0] == '/' || npath[0] == '\\')) {
+ npath.remove_prefix(1);
+ }
+
auto file = backing->GetFileRelative(npath);
- if (file == nullptr)
+ if (file == nullptr) {
return FileSys::ERROR_PATH_NOT_FOUND;
+ }
if (mode == FileSys::Mode::Append) {
return MakeResult<FileSys::VirtualFile>(