diff options
| author | 2018-12-03 17:04:05 -0500 | |
|---|---|---|
| committer | 2018-12-03 17:04:05 -0500 | |
| commit | f7d5f7294425f59bb9d7c417fa04efcbd49ced91 (patch) | |
| tree | fd398c37a6a276a56ab4265bfaa59904f3762e34 /src/core/file_sys/vfs.cpp | |
| parent | Merge pull request #1839 from lioncash/init (diff) | |
| parent | file_sys: Override missing mutating functions to be stubbed out for ReadOnlyV... (diff) | |
| download | yuzu-f7d5f7294425f59bb9d7c417fa04efcbd49ced91.tar.gz yuzu-f7d5f7294425f59bb9d7c417fa04efcbd49ced91.tar.xz yuzu-f7d5f7294425f59bb9d7c417fa04efcbd49ced91.zip | |
Merge pull request #1833 from lioncash/clean
service/fsp_srv: Implement CleanDirectoryRecursively
Diffstat (limited to 'src/core/file_sys/vfs.cpp')
| -rw-r--r-- | src/core/file_sys/vfs.cpp | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/core/file_sys/vfs.cpp b/src/core/file_sys/vfs.cpp index 7b584de7f..e33327ef0 100644 --- a/src/core/file_sys/vfs.cpp +++ b/src/core/file_sys/vfs.cpp | |||
| @@ -384,6 +384,28 @@ bool VfsDirectory::DeleteSubdirectoryRecursive(std::string_view name) { | |||
| 384 | return success; | 384 | return success; |
| 385 | } | 385 | } |
| 386 | 386 | ||
| 387 | bool VfsDirectory::CleanSubdirectoryRecursive(std::string_view name) { | ||
| 388 | auto dir = GetSubdirectory(name); | ||
| 389 | if (dir == nullptr) { | ||
| 390 | return false; | ||
| 391 | } | ||
| 392 | |||
| 393 | bool success = true; | ||
| 394 | for (const auto& file : dir->GetFiles()) { | ||
| 395 | if (!dir->DeleteFile(file->GetName())) { | ||
| 396 | success = false; | ||
| 397 | } | ||
| 398 | } | ||
| 399 | |||
| 400 | for (const auto& sdir : dir->GetSubdirectories()) { | ||
| 401 | if (!dir->DeleteSubdirectoryRecursive(sdir->GetName())) { | ||
| 402 | success = false; | ||
| 403 | } | ||
| 404 | } | ||
| 405 | |||
| 406 | return success; | ||
| 407 | } | ||
| 408 | |||
| 387 | bool VfsDirectory::Copy(std::string_view src, std::string_view dest) { | 409 | bool VfsDirectory::Copy(std::string_view src, std::string_view dest) { |
| 388 | const auto f1 = GetFile(src); | 410 | const auto f1 = GetFile(src); |
| 389 | auto f2 = CreateFile(dest); | 411 | auto f2 = CreateFile(dest); |
| @@ -431,10 +453,34 @@ std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFile(std::string_view name) | |||
| 431 | return nullptr; | 453 | return nullptr; |
| 432 | } | 454 | } |
| 433 | 455 | ||
| 456 | std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFileAbsolute(std::string_view path) { | ||
| 457 | return nullptr; | ||
| 458 | } | ||
| 459 | |||
| 460 | std::shared_ptr<VfsFile> ReadOnlyVfsDirectory::CreateFileRelative(std::string_view path) { | ||
| 461 | return nullptr; | ||
| 462 | } | ||
| 463 | |||
| 464 | std::shared_ptr<VfsDirectory> ReadOnlyVfsDirectory::CreateDirectoryAbsolute(std::string_view path) { | ||
| 465 | return nullptr; | ||
| 466 | } | ||
| 467 | |||
| 468 | std::shared_ptr<VfsDirectory> ReadOnlyVfsDirectory::CreateDirectoryRelative(std::string_view path) { | ||
| 469 | return nullptr; | ||
| 470 | } | ||
| 471 | |||
| 434 | bool ReadOnlyVfsDirectory::DeleteSubdirectory(std::string_view name) { | 472 | bool ReadOnlyVfsDirectory::DeleteSubdirectory(std::string_view name) { |
| 435 | return false; | 473 | return false; |
| 436 | } | 474 | } |
| 437 | 475 | ||
| 476 | bool ReadOnlyVfsDirectory::DeleteSubdirectoryRecursive(std::string_view name) { | ||
| 477 | return false; | ||
| 478 | } | ||
| 479 | |||
| 480 | bool ReadOnlyVfsDirectory::CleanSubdirectoryRecursive(std::string_view name) { | ||
| 481 | return false; | ||
| 482 | } | ||
| 483 | |||
| 438 | bool ReadOnlyVfsDirectory::DeleteFile(std::string_view name) { | 484 | bool ReadOnlyVfsDirectory::DeleteFile(std::string_view name) { |
| 439 | return false; | 485 | return false; |
| 440 | } | 486 | } |