mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu-mainline.git
				synced 2025-03-21 01:53:15 +00:00 
			
		
		
		
	filesystem: Move dir retrieval after path checking in DeleteFile()
We don't need to do the lookup if the path is considered empty currently.
This commit is contained in:
		
							parent
							
								
									c69dc5acf9
								
							
						
					
					
						commit
						fda8f1da20
					
				@ -60,17 +60,20 @@ ResultCode VfsDirectoryServiceWrapper::CreateFile(const std::string& path_, u64
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const {
 | 
					ResultCode VfsDirectoryServiceWrapper::DeleteFile(const std::string& path_) const {
 | 
				
			||||||
    std::string path(FileUtil::SanitizePath(path_));
 | 
					    std::string path(FileUtil::SanitizePath(path_));
 | 
				
			||||||
    auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path));
 | 
					 | 
				
			||||||
    if (path.empty()) {
 | 
					    if (path.empty()) {
 | 
				
			||||||
        // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but...
 | 
					        // TODO(DarkLordZach): Why do games call this and what should it do? Works as is but...
 | 
				
			||||||
        return RESULT_SUCCESS;
 | 
					        return RESULT_SUCCESS;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (dir->GetFile(FileUtil::GetFilename(path)) == nullptr)
 | 
					
 | 
				
			||||||
 | 
					    auto dir = GetDirectoryRelativeWrapped(backing, FileUtil::GetParentPath(path));
 | 
				
			||||||
 | 
					    if (dir->GetFile(FileUtil::GetFilename(path)) == nullptr) {
 | 
				
			||||||
        return FileSys::ERROR_PATH_NOT_FOUND;
 | 
					        return FileSys::ERROR_PATH_NOT_FOUND;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
    if (!dir->DeleteFile(FileUtil::GetFilename(path))) {
 | 
					    if (!dir->DeleteFile(FileUtil::GetFilename(path))) {
 | 
				
			||||||
        // TODO(DarkLordZach): Find a better error code for this
 | 
					        // TODO(DarkLordZach): Find a better error code for this
 | 
				
			||||||
        return ResultCode(-1);
 | 
					        return ResultCode(-1);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return RESULT_SUCCESS;
 | 
					    return RESULT_SUCCESS;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user