fs.exists

From ComputerCraft
Jump to: navigation, search

fs.exists
Function
Syntax
fs.exists()
Returns boolean
API fs
Source CC:Tweaked (source)

Returns true if a file or directory exists at path path, otherwise returns false.

ExampleExampleCheck if directory exists
Creates the directory foo, checking if it exists before and after.
Code
print("Foo exists:", fs.exists("foo"))
print("Making foo")
fs.makeDir("foo")
print("Foo exists:", fs.exists("foo"))
Output
Foo exists: false
Making foo
Foo exists: true