mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	Added CreateDirectory function to service/fs.cpp, and in Archive.
This commit is contained in:
		@@ -380,6 +380,21 @@ Handle OpenFileFromArchive(Handle archive_handle, const std::string& path, const
 | 
			
		||||
    return handle;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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
 | 
			
		||||
 */
 | 
			
		||||
Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& path) {
 | 
			
		||||
    Archive* archive = Kernel::g_object_pool.GetFast<Archive>(archive_handle);
 | 
			
		||||
    if (archive == nullptr)
 | 
			
		||||
        return -1;
 | 
			
		||||
    if (archive->backend->CreateDirectory(path))
 | 
			
		||||
        return 0;
 | 
			
		||||
    return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Open a Directory from an Archive
 | 
			
		||||
 * @param archive_handle Handle to an open Archive object
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,15 @@ Handle CreateArchive(FileSys::Archive* backend, const std::string& name);
 | 
			
		||||
 * @param mode Mode under which to open the File
 | 
			
		||||
 * @return Opened File object
 | 
			
		||||
 */
 | 
			
		||||
Handle OpenFileFromArchive(Handle handle, const std::string& name, const FileSys::Mode mode);
 | 
			
		||||
Handle OpenFileFromArchive(Handle archive_handle, const std::string& name, const FileSys::Mode mode);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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 Whether creation of directory succeeded
 | 
			
		||||
 */
 | 
			
		||||
Result CreateDirectoryFromArchive(Handle archive_handle, const std::string& name);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Open a Directory from an Archive
 | 
			
		||||
@@ -51,7 +59,7 @@ Handle OpenFileFromArchive(Handle handle, const std::string& name, const FileSys
 | 
			
		||||
 * @param path Path to the Directory inside of the Archive
 | 
			
		||||
 * @return Opened Directory object
 | 
			
		||||
 */
 | 
			
		||||
Handle OpenDirectoryFromArchive(Handle handle, const std::string& name);
 | 
			
		||||
Handle OpenDirectoryFromArchive(Handle archive_handle, const std::string& name);
 | 
			
		||||
 | 
			
		||||
/// Initialize archives
 | 
			
		||||
void ArchiveInit();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user