diff options
Diffstat (limited to 'Source/Library')
-rw-r--r-- | Source/Library/Interface/FSNode.iface.h | 6 | ||||
-rw-r--r-- | Source/Library/Userland/Binding/FSNode.class.h | 20 |
2 files changed, 25 insertions, 1 deletions
diff --git a/Source/Library/Interface/FSNode.iface.h b/Source/Library/Interface/FSNode.iface.h index fd99bab..cba4621 100644 --- a/Source/Library/Interface/FSNode.iface.h +++ b/Source/Library/Interface/FSNode.iface.h @@ -12,6 +12,8 @@ enum { //S : static, GET : get, R : root, FN : fsnode #define FNIF_SGETRFN 0 +#define FNIF_SGETCWD 1 //Get current working directory +#define FNIF_SFIND 2 //Find a node following a path from a node #define FNIF_GETNAME 0x10 #define FNIF_TYPE 0x11 @@ -21,5 +23,9 @@ enum { #define FNIF_GETGID 0x15 #define FNIF_GETPERM 0x16 #define FNIF_GETPATH 0x17 +#define FNIF_SETCWD 0x18 //Sets node as current working directory + +#define FNIF_GETIDXCHILD 0x20 //Get child node from index +#define FNIF_GETNAMECHILD 0x21 //Get child node from name #endif diff --git a/Source/Library/Userland/Binding/FSNode.class.h b/Source/Library/Userland/Binding/FSNode.class.h index 95802a4..61ac991 100644 --- a/Source/Library/Userland/Binding/FSNode.class.h +++ b/Source/Library/Userland/Binding/FSNode.class.h @@ -4,7 +4,13 @@ class FSNode : public RessourceCaller { public: static FSNode getRoot() { - return FSNode(RessourceCaller::sCall(FNIF_OBJTYPE, FNIF_SGETRFN)); + return FSNode(sCall(FNIF_OBJTYPE, FNIF_SGETRFN)); + } + static FSNode getCwd() { + return FSNode(sCall(FNIF_OBJTYPE, FNIF_SGETCWD)); + } + static FSNode find(String path) { //Finds a node starting from root node + return FSNode(sCall(FNIF_OBJTYPE, FNIF_SFIND, (u32int)&path, 0)); } FSNode(u32int id) : RessourceCaller(id, FNIF_OBJTYPE) {} @@ -32,4 +38,16 @@ class FSNode : public RessourceCaller { String path() { return String::unserialize(doCall(FNIF_GETPATH)); } + void setCwd() { + doCall(FNIF_SETCWD); + } + FSNode getChild(u32int idx) { + return FSNode(doCall(FNIF_GETIDXCHILD, idx)); + } + FSNode getChild(String name) { + return FSNode(doCall(FNIF_GETNAMECHILD, (u32int)&name)); + } + FSNode findFrom(String path) { //Search a filesystem node starting from here + return FSNode(sCall(FNIF_OBJTYPE, FNIF_SFIND, (u32int)&path, resId())); + } }; |