Jump to content

ManagedMassStorage: Difference between revisions

From Advanced Computers Wiki
No edit summary
No edit summary
Line 33: Line 33:
|Open or create a new file, do not erase the contents, allow only appending.
|Open or create a new file, do not erase the contents, allow only appending.
|}
|}
|-
|<code>:list(string:path)</code>
|<code>string[]</code>
|Returns a list of absolute paths to files in the given directory.
|-
|<code>:fileExists(string:path)</code>
|<code>boolean</code>
|Returns whether the given path exists and represents a file
|-
|<code>:directoryExists(string:path)</code>
|<code>string[]</code>
|Returns whether the given path exists and represents a directory
|-
|<code>:delete(string:path)</code>
|<code>void</code>
|Deletes the specified file or directory. Directories are deleted recursively.
|-
|<code>:move(string:srcPath, string:destPath)</code>
|<code>void</code>
|Moves the specified file or directory to the destination path.
|-
|<code>:makeDirection(string:path)</code>
|<code>void</code>
|Creates a new directory at the specified path.
|-
|<code>:spaceUsed([string:path="/"])</code>
|<code>long</code>
|Returns the amount of space used on this storage device. If a path is given, only the space in this directory is measured.
|}
|}


{{Navbox content}}
{{Navbox content}}

Revision as of 01:22, 2 August 2026

The ManagedMassStorageUD component is what backs Hard Disk Drives and Floppy Disks. This virtual component offers the following properties:

ManagedMassStorageUD component properties
Name Type Read/Write Description
totalCapacityBytes integer READ Total capacity of this drive (capacity is currently not limited, so this is not meaningful currently)
ManagedMassStorageUD component methods
Name Returns Description
:open(string:filePath[, string:mode=r]) filehandle
mode Attempted action
r Open an existing file in read-only mode.
r+ Open an existing file in read-write mode.
w Open a potentially existent file, erase the contents and open it in write-only mode.
w+ Same as w but also allows reading.
a Open or create a new file, do not erase the contents, allow only appending.
:list(string:path) string[] Returns a list of absolute paths to files in the given directory.
:fileExists(string:path) boolean Returns whether the given path exists and represents a file
:directoryExists(string:path) string[] Returns whether the given path exists and represents a directory
:delete(string:path) void Deletes the specified file or directory. Directories are deleted recursively.
:move(string:srcPath, string:destPath) void Moves the specified file or directory to the destination path.
:makeDirection(string:path) void Creates a new directory at the specified path.
:spaceUsed([string:path="/"]) long Returns the amount of space used on this storage device. If a path is given, only the space in this directory is measured.