Skip to content
Jake edited this page Aug 3, 2018 · 5 revisions

The "os" object defined in src/main.c

Every path in any argument listed here must be an absolute path or an error will show you which file is at fault

os.print(string); //Prints the string to stdout
os.sleep(number); //Sleeps the current thread for number of milliseconds (Secs * 1000)
os.run(path); //Executes the filename given and is able to return a value
os.sandbox(string); //Executes the string as Javascript inside it's own scope
os.read(path); //Returns the contents of the filename, or undefined if the file can't be read
os.write(path, string); //Write string to file; if successful, returns true
os.remove(path); //Deletes file from disk; if successful, returns true
os.exists(path); //Returns either "file", "directory", or undefined, if the path doesn't exist
os.getline(prompt); //Gets user input. If a prompt is specified, it displays it on the same line prior
os.getchar(); //Gets a character from stdin. `Doesn't seem to work if the tty/cmd.exe stdin is redirected?`
os.mkdir(path); //Creates a folder; if successful, returns true
os.rmdir(path); //If the folder is empty, it gets removed; if successful, returns true
os.chdir(path); //Change working directory; if successful, returns the full path, otherwise, returns undefined
os.listdir(path); //Returns an array of the contents of the folder, or undefined if the path doesn't exist
                  //Be careful with the return, since if a folder is empty, this will return a blank array
Clone this wiki locally