Drive Example

This example shows how to manipulating drives.

Setup

All you need is a basic computer (had Lua Processor, RAM and EEPROM in it) and a Drive mounted on its Disk Holder.

Find all the Drives

The code below should print all UUIDs of installed drives.

-- Shorten name
fs = filesystem
-- Initialize /dev
if fs.initFileSystem("/dev") == false then
    computer.panic("Cannot initialize /dev")
end
-- List all the drives
for _, drive in pairs(fs.childs("/dev")) do
    print(drive)
end

Mount a Drive

This program shows how to mount your drive to the root mountpoint.

-- Shorten name
fs = filesystem
-- Initialize /dev
if fs.initFileSystem("/dev") == false then
    computer.panic("Cannot initialize /dev")
end
-- Let say UUID of the drive is 7A4324704A53821154104A87BE5688AC
disk_uuid = "7A4324704A53821154104A87BE5688AC"
-- Mount our drive to root
fs.mount("/dev/"..disk_uuid, "/")

Access Drive Folders

Windows

All drives are located at %LocalAppData%\FactoryGame\Saved\SaveGames\Computers

Linux

Locate your Steam library folder(s)

Steam > Settings > Storage > Drive Dropdown

Navigate to the virtual %LocalAppData% directory

<Steam Library>/steamapps/compatdata/526870/pfx/drive_c/users/steamuser/Local Settings/Application Data/

Navigate to the drives folder

<AppData>/FactoryGame/Saved/SaveGames/Computers/