1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2024-06-26 07:03:22 +00:00
CC-Tweaked/src/main/resources/data/computercraft/lua/rom/programs/drive.lua
SquidDev 5e462adc5c Relocate all resource files
- textures/{block,item}s -> textures/{block,item}
 - assets/*/{advancements,lua,recipes} -> data/*/...
2019-04-02 13:18:43 +01:00

22 lines
575 B
Lua

local tArgs = { ... }
-- Get where a directory is mounted
local sPath = shell.dir()
if tArgs[1] ~= nil then
sPath = shell.resolve( tArgs[1] )
end
if fs.exists( sPath ) then
write( fs.getDrive( sPath ) .. " (" )
local nSpace = fs.getFreeSpace( sPath )
if nSpace >= 1000 * 1000 then
print( (math.floor( nSpace / (100 * 1000) ) / 10) .. "MB remaining)" )
elseif nSpace >= 1000 then
print( (math.floor( nSpace / 100 ) / 10) .. "KB remaining)" )
else
print( nSpace .. "B remaining)" )
end
else
print( "No such path" )
end