diff options
| author | 2020-12-10 01:31:58 -0500 | |
|---|---|---|
| committer | 2020-12-10 01:44:43 -0500 | |
| commit | b1657b8c6b4ef07dd6eea92f4559a32ca3e0894a (patch) | |
| tree | 6de62e6d506fb1867794956b52d3c2abde6054bd /src/core/file_sys/vfs.cpp | |
| parent | Merge pull request #5179 from ReinUsesLisp/fs-path (diff) | |
| download | yuzu-b1657b8c6b4ef07dd6eea92f4559a32ca3e0894a.tar.gz yuzu-b1657b8c6b4ef07dd6eea92f4559a32ca3e0894a.tar.xz yuzu-b1657b8c6b4ef07dd6eea92f4559a32ca3e0894a.zip | |
vfs: Use existing type aliases consistently
Makes use of the VirtualDir and VirtualFile aliases across the board
instead of having a few isolated places that don't use it.
Diffstat (limited to 'src/core/file_sys/vfs.cpp')
| -rw-r--r-- | src/core/file_sys/vfs.cpp | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp index b2f026b6d..f497e9396 100644 --- a/src/core/file_sys/vfs.cpp +++ b/src/core/file_sys/vfs.cpp | |||
| @@ -203,7 +203,7 @@ std::string VfsFile::GetFullPath() const { | |||
| 203 | return GetContainingDirectory()->GetFullPath() + "/" + GetName(); | 203 | return GetContainingDirectory()->GetFullPath() + "/" + GetName(); |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | std::shared_ptr<VfsFile> VfsDirectory::GetFileRelative(std::string_view path) const { | 206 | VirtualFile VfsDirectory::GetFileRelative(std::string_view path) const { |
| 207 | auto vec = Common::FS::SplitPathComponents(path); | 207 | auto vec = Common::FS::SplitPathComponents(path); |
| 208 | vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), | 208 | vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), |
| 209 | vec.end()); | 209 | vec.end()); |
| @@ -231,7 +231,7 @@ std::shared_ptr<VfsFile> VfsDirectory::GetFileRelative(std::string_view path) co | |||
| 231 | return dir->GetFile(vec.back()); | 231 | return dir->GetFile(vec.back()); |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | std::shared_ptr<VfsFile> VfsDirectory::GetFileAbsolute(std::string_view path) const { | 234 | VirtualFile VfsDirectory::GetFileAbsolute(std::string_view path) const { |
| 235 | if (IsRoot()) { | 235 | if (IsRoot()) { |
| 236 | return GetFileRelative(path); | 236 | return GetFileRelative(path); |
| 237 | } | 237 | } |
| @@ -239,7 +239,7 @@ std::shared_ptr<VfsFile> VfsDirectory::GetFileAbsolute(std::string_view path) co | |||
| 239 | return GetParentDirectory()->GetFileAbsolute(path); | 239 | return GetParentDirectory()->GetFileAbsolute(path); |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | std::shared_ptr<VfsDirectory> VfsDirectory::GetDirectoryRelative(std::string_view path) const { | 242 | VirtualDir VfsDirectory::GetDirectoryRelative(std::string_view path) const { |
| 243 | auto vec = Common::FS::SplitPathComponents(path); | 243 | auto vec = Common::FS::SplitPathComponents(path); |
| 244 | vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), | 244 | vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), |
| 245 | vec.end()); | 245 | vec.end()); |
| @@ -261,7 +261,7 @@ std::shared_ptr<VfsDirectory> VfsDirectory::GetDirectoryRelative(std::string_vie | |||
| 261 | return dir; | 261 | return dir; |
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | std::shared_ptr<VfsDirectory> VfsDirectory::GetDirectoryAbsolute(std::string_view path) const { | 264 | VirtualDir VfsDirectory::GetDirectoryAbsolute(std::string_view path) const { |
| 265 | if (IsRoot()) { | 265 | if (IsRoot()) { |
| 266 | return GetDirectoryRelative(path); | 266 | return GetDirectoryRelative(path); |
| 267 | } | 267 | } |
| @@ -269,14 +269,14 @@ std::shared_ptr<VfsDirectory> VfsDirectory::GetDirectoryAbsolute(std::string_vie | |||
| 269 | return GetParentDirectory()->GetDirectoryAbsolute(path); | 269 | return GetParentDirectory()->GetDirectoryAbsolute(path); |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | std::shared_ptr<VfsFile> VfsDirectory::GetFile(std::string_view name) const { | 272 | VirtualFile VfsDirectory::GetFile(std::string_view name) const { |
| 273 | const auto& files = GetFiles(); | 273 | const auto& files = GetFiles(); |
| 274 | const auto iter = std::find_if(files.begin(), files.end(), | 274 | const auto iter = std::find_if(files.begin(), files.end(), |
| 275 | [&name](const auto& file1) { return name == file1->GetName(); }); | 275 | [&name](const auto& file1) { return name == file1->GetName(); }); |
| 276 | return iter == files.end() ? nullptr : *iter; | 276 | return iter == files.end() ? nullptr : *iter; |
| 277 | } | 277 | } |
| 278 | 278 | ||
| 279 | std::shared_ptr<VfsDirectory> VfsDirectory::GetSubdirectory(std::string_view name) const { | 279 | VirtualDir VfsDirectory::GetSubdirectory(std::string_view name) const { |
| 280 | const auto& subs = GetSubdirectories(); | 280 | const auto& subs = GetSubdirectories(); |
| 281 | const auto iter = std::find_if(subs.begin(), subs.end(), | 281 | const auto iter = std::find_if(subs.begin(), subs.end(), |
| 282 | [&name](const auto& file1) { return name == file1->GetName(); }); | 282 | [&name](const auto& file1) { return name == file1->GetName(); }); |
| @@ -301,7 +301,7 @@ std::size_t VfsDirectory::GetSize() const { | |||
| 301 | return file_total + subdir_total; | 301 | return file_total + subdir_total; |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | std::shared_ptr<VfsFile> VfsDirectory::CreateFileRelative(std::string_view path) { | 304 | VirtualFile VfsDirectory::CreateFileRelative(std::string_view path) { |
| 305 | auto vec = Common::FS::SplitPathComponents(path); | 305 | auto vec = Common::FS::SplitPathComponents(path); |
| 306 | vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), | 306 | vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), |
| 307 | vec.end()); | 307 | vec.end()); |
| @@ -324,7 +324,7 @@ std::shared_ptr<VfsFile> VfsDirectory::CreateFileRelative(std::string_view path) | |||
| 324 | return dir->CreateFileRelative(Common::FS::GetPathWithoutTop(path)); | 324 | return dir->CreateFileRelative(Common::FS::GetPathWithoutTop(path)); |
| 325 | } | 325 | } |
| 326 | 326 | ||
| 327 | std::shared_ptr<VfsFile> VfsDirectory::CreateFileAbsolute(std::string_view path) { | 327 | VirtualFile VfsDirectory::CreateFileAbsolute(std::string_view path) { |
| 328 | if (IsRoot()) { | 328 | if (IsRoot()) { |
| 329 | return CreateFileRelative(path); | 329 | return CreateFileRelative(path); |
| 330 | } | 330 | } |
| @@ -332,7 +332,7 @@ std::shared_ptr<VfsFile> VfsDirectory::CreateFileAbsolute(std::string_view path) | |||
| 332 | return GetParentDirectory()->CreateFileAbsolute(path); | 332 | return GetParentDirectory()->CreateFileAbsolute(path); |
| 333 | } | 333 | } |
| 334 | 334 | ||
| 335 | std::shared_ptr<VfsDirectory> VfsDirectory::CreateDirectoryRelative(std::string_view path) { | 335 | VirtualDir VfsDirectory::CreateDirectoryRelative(std::string_view path) { |
| 336 | auto vec = Common::FS::SplitPathComponents(path); | 336 | auto vec = Common::FS::SplitPathComponents(path); |
| 337 | vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), | 337 | vec.erase(std::remove_if(vec.begin(), vec.end(), [](const auto& str) { return str.empty(); }), |
| 338 | vec.end()); | 338 | vec.end()); |
| @@ -355,7 +355,7 @@ std::shared_ptr<VfsDirectory> VfsDirectory::CreateDirectoryRelative(std::string_ | |||
| 355 | return dir->CreateDirectoryRelative(Common::FS::GetPathWithoutTop(path)); | 355 | return dir->CreateDirectoryRelative(Common::FS::GetPathWithoutTop(path)); |
| 356 | } | 356 | } |
| 357 | 357 | ||
| 358 | std::shared_ptr<VfsDirectory> VfsDirectory::CreateDirectoryAbsolute(std::string_view path) { | 358 | VirtualDir VfsDirectory::CreateDirectoryAbsolute(std::string_view path) { |
| 359 | if (IsRoot()) { | 359 | if (IsRoot()) { |
| 360 | return CreateDirectoryRelative(path); | 360 | return CreateDirectoryRelative(path); |
| 361 | } | 361 | } |
| @@ -446,27 +446,27 @@ bool ReadOnlyVfsDirectory::IsReadable() const { | |||
| 446 | return true; | 446 | return true; |
| 447 | } | 447 | } |
| 448 | 448 | ||
| 449 | std::shared_ptr<VfsDirectory> ReadOnlyVfsDirectory::CreateSubdirectory(std::string_view name) { | 449 | VirtualDir ReadOnlyVfsDirectory::CreateSubdirectory(std::string_view name) { |
| 450 | return nullptr; | 450 | return nullptr; |
| 451 | } | 451 | } |
| 452 | 452 | ||
| 453 | std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFile(std::string_view name) { | 453 | VirtualFile ReadOnlyVfsDirectory::CreateFile(std::string_view name) { |
| 454 | return nullptr; | 454 | return nullptr; |
| 455 | } | 455 | } |
| 456 | 456 | ||
| 457 | std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFileAbsolute(std::string_view path) { | 457 | VirtualFile ReadOnlyVfsDirectory::CreateFileAbsolute(std::string_view path) { |
| 458 | return nullptr; | 458 | return nullptr; |
| 459 | } | 459 | } |
| 460 | 460 | ||
| 461 | std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFileRelative(std::string_view path) { | 461 | VirtualFile ReadOnlyVfsDirectory::CreateFileRelative(std::string_view path) { |
| 462 | return nullptr; | 462 | return nullptr; |
| 463 | } | 463 | } |
| 464 | 464 | ||
| 465 | std::shared_ptr<VfsDirectory> ReadOnlyVfsDirectory::CreateDirectoryAbsolute(std::string_view path) { | 465 | VirtualDir ReadOnlyVfsDirectory::CreateDirectoryAbsolute(std::string_view path) { |
| 466 | return nullptr; | 466 | return nullptr; |
| 467 | } | 467 | } |
| 468 | 468 | ||
| 469 | std::shared_ptr<VfsDirectory> ReadOnlyVfsDirectory::CreateDirectoryRelative(std::string_view path) { | 469 | VirtualDir ReadOnlyVfsDirectory::CreateDirectoryRelative(std::string_view path) { |
| 470 | return nullptr; | 470 | return nullptr; |
| 471 | } | 471 | } |
| 472 | 472 | ||