mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-11-03 23:28:48 +00:00 
			
		
		
		
	Added DeleteFile and DeleteDirectory functions to FS:USER and the archives.
This commit is contained in:
		
							parent
							
								
									b66859714b
								
							
						
					
					
						commit
						8aeadbd95a
					
				
					 8 changed files with 194 additions and 26 deletions
				
			
		| 
						 | 
				
			
			@ -391,11 +391,41 @@ Handle OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, con
 | 
			
		|||
    return handle;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Delete a File from an Archive
 | 
			
		||||
 * @param archive_handle Handle to an open Archive object
 | 
			
		||||
 * @param path Path to the File inside of the Archive
 | 
			
		||||
 * @return Whether deletion succeeded
 | 
			
		||||
 */
 | 
			
		||||
Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path) {
 | 
			
		||||
    Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
 | 
			
		||||
    if (archive == nullptr)
 | 
			
		||||
        return -1;
 | 
			
		||||
    if (archive->backend->DeleteFile(path))
 | 
			
		||||
        return 0;
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Delete a Directory from an Archive
 | 
			
		||||
 * @param archive_handle Handle to an open Archive object
 | 
			
		||||
 * @param path Path to the Directory inside of the Archive
 | 
			
		||||
 * @return Whether deletion succeeded
 | 
			
		||||
 */
 | 
			
		||||
Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
 | 
			
		||||
    Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
 | 
			
		||||
    if (archive == nullptr)
 | 
			
		||||
        return -1;
 | 
			
		||||
    if (archive->backend->DeleteDirectory(path))
 | 
			
		||||
        return 0;
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Create a Directory from an Archive
 | 
			
		||||
 * @param archive_handle Handle to an open Archive object
 | 
			
		||||
 * @param path Path to the Directory inside of the Archive
 | 
			
		||||
 * @return Opened Directory object
 | 
			
		||||
 * @return Whether creation succeeded
 | 
			
		||||
 */
 | 
			
		||||
Result CreateDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path) {
 | 
			
		||||
    Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -45,6 +45,22 @@ Handle CreateArchive(FileSys::Archive* backend, const std::string& name);
 | 
			
		|||
 */
 | 
			
		||||
Handle OpenFileFromArchive(Handle archive_handle, const FileSys::Path& path, const FileSys::Mode mode);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Delete a File from an Archive
 | 
			
		||||
 * @param archive_handle Handle to an open Archive object
 | 
			
		||||
 * @param path Path to the File inside of the Archive
 | 
			
		||||
 * @return Whether deletion succeeded
 | 
			
		||||
 */
 | 
			
		||||
Result DeleteFileFromArchive(Handle archive_handle, const FileSys::Path& path);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Delete a Directory from an Archive
 | 
			
		||||
 * @param archive_handle Handle to an open Archive object
 | 
			
		||||
 * @param path Path to the Directory inside of the Archive
 | 
			
		||||
 * @return Whether deletion succeeded
 | 
			
		||||
 */
 | 
			
		||||
Result DeleteDirectoryFromArchive(Handle archive_handle, const FileSys::Path& path);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Create a Directory from an Archive
 | 
			
		||||
 * @param archive_handle Handle to an open Archive object
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue