61 posts
Posted 28 May 2014 - 09:15 PM
Is it possible to read the ComputerCraft.cfg file found in %AppData%\Roaming\.minecraft\config\ directly within CC?
I want to check the settings in that file before continuing with a script.
1281 posts
Posted 28 May 2014 - 09:24 PM
No it is not. You can however pretty easily determine what most of the settings are using internal code. What do you need to know?
Edited on 28 May 2014 - 07:24 PM
61 posts
Posted 28 May 2014 - 10:03 PM
2 things:
# The disk space limit for computers and turtles, in bytes
# The disk space limit for floppy disks, in bytes
1610 posts
Posted 28 May 2014 - 10:24 PM
2 things:
# The disk space limit for computers and turtles, in bytes
# The disk space limit for floppy disks, in bytes
You can check the remaining space on either medium via the fs API. Not perfect, but best you can get.
1281 posts
Posted 28 May 2014 - 10:36 PM
You could get the total size aswell, but there's really no point and doing so would be pretty demanding.
61 posts
Posted 28 May 2014 - 10:45 PM
Thanks for the tips
I think I can achieve want I want by attempting to copy my script twice and checking for errors. The script is 400kB in size, so if copied twice, it will fail with the default 1MB turtle disk size. I can assume if the player has altered the settings to 10MB as requested, that they have also altered the floppy disk size to 1MB. I will work on this and see what I can come up with.
1610 posts
Posted 28 May 2014 - 10:47 PM
Thanks for the tips
I think I can achieve want I want by attempting to copy my script twice and checking for errors. The script is 400kB in size, so if copied twice, it will fail with the default 1MB turtle disk size. I can assume if the player has altered the settings to 10MB as requested, that they have also altered the floppy disk size to 1MB. I will work on this and see what I can come up with.
400 kb + 400kb < 1 MB…
Just use fs.getFreeSpace("") to check if there's enough remaining space for the files. (Keep in mind it's returned in bytes)
61 posts
Posted 28 May 2014 - 11:07 PM
400 kb + 400kb < 1 MB…
That's why I said copy twice!
But getting the free space looks to be a winner.
Thanks