forked from AbleOS/ableos
44 lines
821 B
Plaintext
44 lines
821 B
Plaintext
stn := @use("stn");
|
|
|
|
.{string, buffer, log} := stn;
|
|
.{info} := log;
|
|
|
|
.{acs} := stn;
|
|
.{BufferID} := acs
|
|
|
|
FilesystemServiceListing := struct {
|
|
// The Root to match against of the file system
|
|
root: ^u8,
|
|
// Replace with a slice here soon.
|
|
// The buffer to forward fs requests to.
|
|
buffer_id: BufferID,
|
|
}
|
|
|
|
main := fn(): int {
|
|
log.info("VFSaur starting.\0")
|
|
vfs_buff := buffer.create("VFS\0")
|
|
|
|
full_path := "acs:/path/to/a/file\0"
|
|
a := parse_str_to_path(full_path)
|
|
|
|
return 0
|
|
}
|
|
|
|
OSPath := struct {root: ^u8, path: ^u8}
|
|
|
|
parse_str_to_path := fn(full_path: ^u8): ?OSPath {
|
|
split := string.split(full_path, '/')
|
|
root := split.next()
|
|
path := split.next()
|
|
|
|
if root == null {
|
|
log.error("Root is null.\0")
|
|
return null
|
|
}
|
|
if path == null {
|
|
log.error("Path is null.\0")
|
|
return null
|
|
}
|
|
return OSPath.(root, path)
|
|
}
|