uses time.DateTime
/* {"description" : "This is a container type to represent the path of a file system element."} */
data FileEntry{
/* {"@description" : "The path of this file system element."} */
char name[]
}
/* {"description" : "Data type to represent information about a filesystem element."} */
data FileInfo{
/* {"@description" : "Possible value of the 'type' field, indicating that this element is a regular file."} */
const byte TYPE_FILE = 1
/* {"@description" : "Possible value of the 'type' field, indicating that this element is a directory."} */
const byte TYPE_DIR = 2
/* {"@description" : "The type of this filesystem element (e.g. a file or directory)."} */
byte type
/* {"@description" : "The size of this filesystem element on disk, if it is a regular file (this field will be zero for directories)."} */
int size
/* {"@description" : "The last-modified time of this filesystem element on disk, if it is a regular file."} */
DateTime modified
}
/*
{"description" : "Examine the contents of a file system and read information about individual files."}
*/
interface FileSystem{
/*
{"@description" : "Get a list of files and folders in a given directory.",
"@return" : "A list of file and directory names that appear in the given directory."}
*/
FileEntry[] getDirectoryContents(char path[])
/*
{"@description" : "Get information about a specific file or directory."}
*/
FileInfo getInfo(char path[])
/*
{"@description" : "Check if a given file or folder exists.",
"@return" : "True if the file or folder exists, false otherwise."}
*/
bool exists(char path[])
/*
{"@description" : "Delete a file.",
"@return" : "True if successful, false otherwise (for example if the file did not exist)."}
*/
bool delete(char path[])
/*
{"@description" : "Move a file or directory to a new location.",
"@return" : "True if successful, false otherwise."}
*/
bool move(char path[], char newPath[])
/*
{"@description" : "Copy a file or directory to a new location.",
"@return" : "True if successful, false otherwise."}
*/
bool copy(char path[], char newPath[], opt bool recursive)
/*
{"@description" : "Create a new directory.",
"@return" : "True if successful, false otherwise."}
*/
bool createDirectory(char path[])
/*
{"@description" : "Permanently delete a given directory, and all of its contents.",
"@return" : "True if successful, false otherwise."}
*/
bool deleteDirectory(char path[])
/*
{"@description" : "Get the absolute path of the given (potentially relative) file path."}
*/
char[] getFullPath(char path[])
}
To propose a new revision to this entity, use dana source put -ut your/new/version.dn -n io.FileSystem -m "reason for update" -u yourUsername
Version 1 (this version) by barry
Notes for this version: Standard Library Initialisation