MCJack123 / craftos2

A fast, modern, and feature-filled ComputerCraft emulator written in C++.
https://www.craftos-pc.cc
Other
217 stars 25 forks source link

Error when trying to edit a file with a nonexistent directory #330

Closed AlphaTechNinja closed 6 months ago

AlphaTechNinja commented 8 months ago

When I try to make a file in a dictionary that doesn't exist yet it gives errors saying "No such path" even though ComputerCraft is supposed to auto create directorys when the path doesn't exist

To see this bug type in edit somepath/file.lua you will get error /rom/programs/edit.lua:114: /somepath/file.lua: No such path

I'm running this on the mobile IOS app

This happened after a recent update

AlphaTechNinja commented 6 months ago

Issue still persists It seems it's in the actual editing program in rom it says On line 144 in if statement

if not bReadOnly and fs.getFreeSpace(sPath) < 1024 then
set_status("Disk is low on space")
else
local message
...

Results in the error message saying no such path. I suspect the error is being caused in the fs library getFreeSpace function when the path doesn't exists

AlphaTechNinja commented 6 months ago

Fixed in Lua side by changing

if not bReadOnly and fs.getFreeSpace(sPath) < 1024 then
...

To

if not bReadOnly and fs.exists(sPath) and fs.getFreeSpace(sPath) < 1024 then
...
MCJack123 commented 6 months ago

The fix hasn't been merged yet. Please wait for v2.8 to merge.

AlphaTechNinja commented 6 months ago

Ok sorry I didn't know

AlphaTechNinja commented 3 months ago

Thank you for merging this update to the IOS app it seems to have fixed the issue