Difference between revisions of "Fs (API)"

From ComputerCraft Wiki
Jump to: navigation, search
(Gave missing information for fs.open() and fs.list())
Line 38: Line 38:
 
|-
 
|-
 
|[[fs.open]]( path, mode )
 
|[[fs.open]]( path, mode )
|Opens the given path. Modes: "r", "w", "a", "rb", "wb", "ab". Meaning: r: read mode, w: write mode, a: append mode, rb: Unknown, wb: Unknown, ab: Unknown.
+
|Opens the given path. Modes: "r", "w", "a", "rb", "wb", "ab". Meaning: r: read mode, w: write mode, a: append mode, *b: binary mode.
 
|}
 
|}
 
[[Category:APIs]]
 
[[Category:APIs]]

Revision as of 21:26, 7 March 2012

The FS API allows you to mess around with the filesystem.

Method name Description
fs.list( path ) Lists the directories and files in the given path.
fs.exists( path ) Checks if the given path exists
fs.isDir( path ) Checks if the given path is a directory.
fs.isReadOnly( path ) Checks if you can only read to a directory.
fs.getName( path ) <no description given>
fs.getDrive( path ) <no description given>
fs.makeDir( path ) Makes a directory.
fs.move( path, path ) Moves path 1 to path 2.
fs.copy( path, path ) Copies path 1 to path 2.
fs.delete( path ) Deletes the given path.
fs.combine( path, localpath ) Adds the given path and the local path together to make a new path. Like if localpath is C\ and path is programs\, it will make C\programs\ and return it.
fs.open( path, mode ) Opens the given path. Modes: "r", "w", "a", "rb", "wb", "ab". Meaning: r: read mode, w: write mode, a: append mode, *b: binary mode.