This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
SethShadowrider's profile picture

Fs Api help

Started by SethShadowrider, 23 June 2012 - 05:40 PM
SethShadowrider #1
Posted 23 June 2012 - 07:40 PM
Can somebody tell me how to check for a file on a disk? I'm trying to make a system that checks for a specific access level on a disk and runs a program accordingly. I just cant figure out how to use fs api. The wiki is no help and checking around the forums is no help either… I just need to know how to check for a file called "Lv1" when a disk is inserted.
Exerro #2
Posted 23 June 2012 - 07:46 PM
Im not sure how to do it so it checks when you put the disk in but

if fs.exists("Lv1") then
(what you want it to do)
else
(what you want it to do)
end
that will check if it exists and do something if it does…
SethShadowrider #3
Posted 23 June 2012 - 07:50 PM
That makes sense. To check for an inserted disk its

local evt, side = os.pullEvent("disk")
By the way
Exerro #4
Posted 23 June 2012 - 07:51 PM
Cool thanks
MysticT #5
Posted 23 June 2012 - 08:09 PM
Im not sure how to do it so it checks when you put the disk in but

if fs.exists("Lv1") then
(what you want it to do)
else
(what you want it to do)
end
that will check if it exists and do something if it does…
Just remember to use "disk/Lv1", since the fs api needs absolute paths and the file is in the disk.