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

[Question] Is there a maximum file size for ComputerCraft?

Started by Cranium, 19 September 2012 - 08:47 PM
Cranium #1
Posted 19 September 2012 - 10:47 PM
I am wanting to add a logging script into my program, for error reports, and the such, but I would like to know if there is a maximum file size for files in CC. I seem to remember hearing this, but I can't find a post anywhere about it.
If there is a maximum file size, how do I have a program create a logfile to post actions taken, then only keep the last few actions completed? I already know how to create a save file, but to do a logfile would be difficult I think.
Noodle #2
Posted 19 September 2012 - 11:00 PM
1.41 has it.
Go to your config files in your MC folder, you can change the value.
Cranium #3
Posted 19 September 2012 - 11:03 PM
I'm not at my Minecraft computer right now, but there is, huh? That makes problems for me. I need my log to be available on multiple systems/servers. I guess I'll have to find a way to keep only the last few actions completed. TO THE CODEATORIUM!
MysticT #4
Posted 19 September 2012 - 11:27 PM
I'm not at my Minecraft computer right now, but there is, huh? That makes problems for me. I need my log to be available on multiple systems/servers. I guess I'll have to find a way to keep only the last few actions completed. TO THE CODEATORIUM!
The default size is 2MB per computer/turtle, and 512KB for disks. So, unless you plan to create log file of more than 1MB, you should be fine.
Also, you can remove the limit by setting it to 0.
Cranium #5
Posted 19 September 2012 - 11:32 PM
Alright. So now that I know there is a file size limit, Anyone know what happens when the file is too big? I'm just covering all my bases here, in the unlikely event that the log file gets too big. If fs.writeLine() just deletes the top line and adds the bottom line, that is fine for me, it just means less coding. Otherwise, I'm going to try to find a way to write maybe the last 25 actions.
D3matt #6
Posted 20 September 2012 - 05:25 AM
Keep in mind that's the limit for the ENTIRE STORAGE SPACE of the computer or disk. As far as I know there is no per-file limit, and I'm not sure how it handles exceeding the size, especially when one single file is taking up the whole space.
Cranium #7
Posted 20 September 2012 - 03:42 PM
Well, I guess I'll write a sample program to test this. Posting the ticks in a file, and adding to a new line. When the program errors, that's how big. But i don't need to error out, I can just use tables to add to the last line, then remove the first line.