Jump to content




Weird error?


3 replies to this topic

#1 IndustrialLemon

  • Members
  • 61 posts

Posted 04 November 2018 - 08:19 AM

Hey! Me again. Sorry for the incessant posts but I just can't get enough of lua! Been programming my butt off.

Here's the code.
Spoiler

The error I receive when first running the code on a blank computer is this.
startup.lua:19: auto.lua: File Exists
The idea is to be installing a load of programs from the disk/CnS/ dir onto the turtle that's parked by the disk drive.
Afterward, if I check the list of programs under the CnS/ dir, auto.lua is the only one showing up.
There should be a few more than that.
I believe it's attempting to copy the program twice which is producing the error but I cannot for the life of me figure out where it's doing that? I need an extra pair of eyes if anyone is willing to take a look.

Thank you!

OH and don't get the wrong idea I still need help with my other posts! I've got a bunch of different projects that I'm bouncing between.

EDIT:
I've patched my bug but I'm not sure if this is the roundabout way or the exact way I needed to do it.
In order to fix it I simply put fs.delete("CnS/"..disk_commandList) right before the fs.copy(...) and that seems ot have fixed it.

Edited by IndustrialLemon, 04 November 2018 - 08:29 AM.


#2 Lupus590

  • Members
  • 2,029 posts
  • LocationUK

Posted 04 November 2018 - 10:27 AM

The issue is that fs.copydoesn't like to overwrite files and you told it to do that, by deleting first you make sure that the file won't exist.

#3 IndustrialLemon

  • Members
  • 61 posts

Posted 04 November 2018 - 06:53 PM

I understand that much but I'm still confused because when I would do 'delete CnS/' manually before updating it would still produce that error. Am I just blind?

#4 KingofGamesYami

  • Members
  • 3,002 posts
  • LocationUnited States of America

Posted 04 November 2018 - 09:46 PM

There is no functional difference between deleting inside a program and deleting manually.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users