fs.isReadOnly

From ComputerCraft
Jump to: navigation, search

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

Returns true if the file or directory at path path is read-only, meaning files cannot be created or changed there. Returns false if the path path is writable, or if it does not exist. /rom is an example of a read-only mount – you cannot create your own files there, or change files there.

ExampleExampleCheck if two directories are read-only
Creates the directory foo in the root directory (/), and checks if it is read-only. Also checks if /rom/programs is read-only.
Code
print("Making foo")
fs.makeDir("foo")
print("/foo is read-only:", fs.isReadOnly("/foo"))
print("/rom/programs is read-only:", fs.isReadOnly("/rom/programs"))
Output
Making foo
/foo is read-only: false
/rom/programs is read-only: true