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

data dumper API / program

Started by qwerty, 18 July 2017 - 01:21 AM
qwerty #1
Posted 18 July 2017 - 03:21 AM
So I started working on a dtdmp (data dump) program and I've tried for what seems to be 4 - 5 hours trying to figure it out and yes I did follow the rules of thumb: check the api list, look for similar and resolved issues on the forum, check if anyone has done such a thing!
why I need this is for a turtle to communicate with a computer via a disk drive to instantly give instructions to each other.
I've tried the fs api. the copy program, and I can't come up with a solution to blacklist things to copy to the drive.
With regards
- Qwerty -
Bomb Bloke #2
Posted 18 July 2017 - 04:36 AM
local blacklist = {["someFileName"] = true, ["someOtherFileName"] = true, ["yetAnotherFileName"] = true}

if not blacklist[varWithNameOfFileYouWantToCopy] then
	-- copy file
end

If you're still having trouble, elaborate on the part where you're getting stuck - what code have you tried, and how did the result differ from what you wanted?
qwerty #3
Posted 18 July 2017 - 06:30 AM
sorry if I haven't described my exquisite desires to copy every single item on the computer exept disk/ and rom/, in the mean time, thank you for your loyal devotion to this quite intriguing and amazing community!
with regards
- Qwerty -
Bomb Bloke #4
Posted 18 July 2017 - 06:39 AM
If you only want to blacklist files that "aren't on the computer's own drive", then you just need to check that fs.getDrive(path) == "hdd".
qwerty #5
Posted 18 July 2017 - 06:45 AM
but then how do I blacklist the rom folder? thanks tho for the drive check!
Bomb Bloke #6
Posted 18 July 2017 - 07:00 AM
"rom" is considered a drive of its own.
qwerty #7
Posted 18 July 2017 - 07:34 AM
well thank you kind sir!