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

Problem with floppy disk

Started by CloudyChmura, 11 December 2016 - 06:46 PM
CloudyChmura #1
Posted 11 December 2016 - 07:46 PM
I am green from that I start.
I have a problem with a program that needs to verify whether it is on a floppy disk or on a computer or it can be something to check?
Lyqyd #2
Posted 11 December 2016 - 08:35 PM
Moved to Ask a Pro.
supernicejohn #3
Posted 11 December 2016 - 09:24 PM
Not too familiar with floppy disks and the like, but I think

fs.getDir(shell.getRunningProgram())
Will do the trick. Not sure, but that's how I'd determine the directory to a program on the computer.
Anavrins #4
Posted 11 December 2016 - 09:54 PM
Use fs.getDrive instead.
It will return "hdd" if the file is located locally on the computer, or "rom" if it's in rom.
If your file is running on a disk then it will return the side where your drive is located.

local fDrive = fs.getDrive(shell.getRunningProgram())
if fDrive == "hdd" or fDrive == "rom" then
  print("File is running from hdd")
else
  print("File is on a floppy")
end
Edited on 11 December 2016 - 08:59 PM