diff options
| author | 2019-04-05 10:52:54 -0400 | |
|---|---|---|
| committer | 2019-04-05 10:52:54 -0400 | |
| commit | d6b7195192057a61b448a353bcf109cc2ddd2d73 (patch) | |
| tree | df7ceb4f42977c3182f9ec2135a8889752caae96 /src/core | |
| parent | Merge pull request #2282 from bunnei/gpu-asynch-v2 (diff) | |
| parent | filesystem: Use a std::string_view in OpenFile() (diff) | |
| download | yuzu-d6b7195192057a61b448a353bcf109cc2ddd2d73.tar.gz yuzu-d6b7195192057a61b448a353bcf109cc2ddd2d73.tar.xz yuzu-d6b7195192057a61b448a353bcf109cc2ddd2d73.zip | |
Merge pull request #2338 from lioncash/fs
filesystem: Use a std::string_view in OpenFile()
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/hle/service/filesystem/filesystem.cpp | 13 |
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 | |||
| 197 | 197 | ||
| 198 | ResultVal<FileSys::VirtualFile> VfsDirectoryServiceWrapper::OpenFile(const std::string& path_, | 198 | ResultVal<FileSys::VirtualFile> VfsDirectoryServiceWrapper::OpenFile(const std::string& path_, |
| 199 | FileSys::Mode mode) const { | 199 | FileSys::Mode mode) const { |
| 200 | std::string path(FileUtil::SanitizePath(path_)); | 200 | const std::string path(FileUtil::SanitizePath(path_)); |
| 201 | auto npath = path; | 201 | std::string_view npath = path; |
| 202 | while (npath.size() > 0 && (npath[0] == '/' || npath[0] == '\\')) | 202 | while (!npath.empty() && (npath[0] == '/' || npath[0] == '\\')) { |
| 203 | npath = npath.substr(1); | 203 | npath.remove_prefix(1); |
| 204 | } | ||
| 205 | |||
| 204 | auto file = backing->GetFileRelative(npath); | 206 | auto file = backing->GetFileRelative(npath); |
| 205 | if (file == nullptr) | 207 | if (file == nullptr) { |
| 206 | return FileSys::ERROR_PATH_NOT_FOUND; | 208 | return FileSys::ERROR_PATH_NOT_FOUND; |
| 209 | } | ||
| 207 | 210 | ||
| 208 | if (mode == FileSys::Mode::Append) { | 211 | if (mode == FileSys::Mode::Append) { |
| 209 | return MakeResult<FileSys::VirtualFile>( | 212 | return MakeResult<FileSys::VirtualFile>( |