←  Ask a Pro

ComputerCraft | Programmable Computers for Minecraft

»

data dumper API / program

qwerty's Photo qwerty 18 Jul 2017

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 -
Quote

Bomb Bloke's Photo Bomb Bloke 18 Jul 2017

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?
Quote

qwerty's Photo qwerty 18 Jul 2017

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 -
Quote

Bomb Bloke's Photo Bomb Bloke 18 Jul 2017

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".
Quote

qwerty's Photo qwerty 18 Jul 2017

but then how do I blacklist the rom folder? thanks tho for the drive check!
Quote

Bomb Bloke's Photo Bomb Bloke 18 Jul 2017

"rom" is considered a drive of its own.
Quote

qwerty's Photo qwerty 18 Jul 2017

well thank you kind sir!
Quote