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

[1.3 and 1.4][SMP/SSP]fs API acting strange

Started by Pintrix, 27 December 2012 - 11:34 PM
Pintrix #1
Posted 28 December 2012 - 12:34 AM
ComputerCraft version: tested it with both 1.33 and 1.48 (Client and Server)

What happens:
  • I tested the fs API with a simple fs.list("")[1], expecting to get Applications (I'm using a mac), but instead I got rom, which could only mean that the paths are relative to the lua directory.
  • When trying to make a directory with fs.makeDir("test"), no directory shows up, neither in my computer's root folder, nor in lua. However, ComputerCraft does think it exists: for example, when I execute fs.list("")[2] after creating that test folder, it does return test, although it is visible in neither Finder nor the terminal.
ComputerCraft can work with existing files within the lua folder though: I can read and write from and to files I created with an external text editor.

I don't know how to reproduce the bug. I'm the only one I know who's having this specific problem.

Is anyone having the same problem, or does anyone know how to fix it?

Thanks in advance
Cloudy #2
Posted 28 December 2012 - 01:26 AM
Each computer has its own folder in /saves/savename/computer/id. That is where the files are stored. It is sandboxed to prevent access outside of that folder. The "rom" folder is shared between all Computers.
Pintrix #3
Posted 28 December 2012 - 02:36 AM
Thanks a LOT!
But then it's kind of strange that ComputerCraft wiki says that every path in the fs API (except for fs.combine()) uses absolute paths.
( http://computercraft.info/wiki/Fs_(API) )
Thanks again :)/>
Cloudy #4
Posted 28 December 2012 - 02:55 AM
Thanks a LOT!
But then it's kind of strange that ComputerCraft wiki says that every path in the fs API (except for fs.combine()) uses absolute paths.
( http://computercraft.info/wiki/Fs_(API) )
Thanks again :)/>/>

Absolute relative to the Computer environment.
Pintrix #5
Posted 28 December 2012 - 03:30 AM
Absolute relative to the Computer environment.

The wiki says otherwise:

(http://computercraft...o/wiki/Fs_(API))
Each path name consists of a list of nonempty path components separated by forward slashes, and those path components are taken one by one with the first being contained in the root directory of the computer.
Cloudy #6
Posted 28 December 2012 - 03:47 AM
That snippet says exactly what I'm saying.
MysticT #7
Posted 28 December 2012 - 03:53 AM
When it says computer, it means the CC computer, not your computer :P/>
Pintrix #8
Posted 28 December 2012 - 03:59 AM
O, now I get it. My bad :)/>