mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-11 13:39:55 +02:00
System/Libraries/FileSystem: Add FileSystem.CreatePath()
This commit is contained in:
@@ -27,6 +27,7 @@ extern I64 @plan9fs_write_file(U8* path, U64 buffer, I64 size);
|
|||||||
class @filesystem
|
class @filesystem
|
||||||
{
|
{
|
||||||
I64 root_fs_type;
|
I64 root_fs_type;
|
||||||
|
Bool (*CreatePath)(U8* path);
|
||||||
@dir_entry (*GetFiles)(U8* path);
|
@dir_entry (*GetFiles)(U8* path);
|
||||||
U8* (*GetFileExtension)(U8* path);
|
U8* (*GetFileExtension)(U8* path);
|
||||||
U0 (*Init)();
|
U0 (*Init)();
|
||||||
@@ -225,6 +226,31 @@ I64 @filesystem_write_file(U8* path, U8* buffer, I64 size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bool @filesystem_create_path(U8* path)
|
||||||
|
{
|
||||||
|
if (!path)
|
||||||
|
return FALSE;
|
||||||
|
U8 buf[512];
|
||||||
|
I64 type = @filesystem_get_type(path);
|
||||||
|
switch (type) {
|
||||||
|
case FS_TYPE_SYSTEM:
|
||||||
|
return FALSE;
|
||||||
|
SysHlt;
|
||||||
|
break;
|
||||||
|
case FS_TYPE_REDSEA:
|
||||||
|
StrPrint(&buf, "%c:%s", ToUpper(path[12]), path + 13);
|
||||||
|
return Cd(&buf, TRUE);
|
||||||
|
break;
|
||||||
|
case FS_TYPE_9P:
|
||||||
|
return FALSE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileSystem.CreatePath = &@filesystem_create_path;
|
||||||
FileSystem.GetFiles = &@filesystem_get_files;
|
FileSystem.GetFiles = &@filesystem_get_files;
|
||||||
FileSystem.GetFileExtension = &@filesystem_get_file_extension;
|
FileSystem.GetFileExtension = &@filesystem_get_file_extension;
|
||||||
FileSystem.PathExists = &@filesystem_path_exists;
|
FileSystem.PathExists = &@filesystem_path_exists;
|
||||||
|
|||||||
Reference in New Issue
Block a user