mirror of
https://github.com/kepler155c/opus
synced 2025-01-03 20:30:28 +00:00
cleanup
This commit is contained in:
parent
86be65f026
commit
e2508c9037
@ -414,6 +414,16 @@ end
|
|||||||
|
|
||||||
function Util.writeFile(fname, data)
|
function Util.writeFile(fname, data)
|
||||||
if not fname or not data then error('Util.writeFile: invalid parameters', 2) end
|
if not fname or not data then error('Util.writeFile: invalid parameters', 2) end
|
||||||
|
|
||||||
|
if fs.exists(fname) then
|
||||||
|
local diff = #data - fs.getSize(fname)
|
||||||
|
if diff > 0 then
|
||||||
|
if fs.getFreeSpace(fs.getDir(fname)) < diff then
|
||||||
|
error('Insufficient disk space for ' .. fname)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
local file = io.open(fname, "w")
|
local file = io.open(fname, "w")
|
||||||
if not file then
|
if not file then
|
||||||
error('Unable to open ' .. fname, 2)
|
error('Unable to open ' .. fname, 2)
|
||||||
|
@ -13,6 +13,7 @@ if not _G.http.websocket then
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not _G.cloud_catcher then
|
if not _G.cloud_catcher then
|
||||||
|
print('Visit https://cloud-catcher.squiddev.cc')
|
||||||
print('Paste key: ')
|
print('Paste key: ')
|
||||||
local key = read()
|
local key = read()
|
||||||
if #key == 0 then
|
if #key == 0 then
|
||||||
|
@ -6,6 +6,7 @@ if not _G.http.websocket then
|
|||||||
end
|
end
|
||||||
|
|
||||||
if not _G.cloud_catcher then
|
if not _G.cloud_catcher then
|
||||||
|
print('Visit https://cloud-catcher.squiddev.cc')
|
||||||
print('Paste key: ')
|
print('Paste key: ')
|
||||||
local key = read()
|
local key = read()
|
||||||
if #key == 0 then
|
if #key == 0 then
|
||||||
|
@ -113,6 +113,7 @@ local function splitpath(path)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function getNode(dir)
|
local function getNode(dir)
|
||||||
|
if not dir then error('Invalid directory', 2) end
|
||||||
local cd = fs.combine(dir, '')
|
local cd = fs.combine(dir, '')
|
||||||
local parts = splitpath(cd)
|
local parts = splitpath(cd)
|
||||||
local node = fs.nodes
|
local node = fs.nodes
|
||||||
@ -176,6 +177,8 @@ function fs.listEx(dir)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function fs.copy(s, t)
|
function fs.copy(s, t)
|
||||||
|
if not s then error('copy: bad argument #1') end
|
||||||
|
if not t then error('copy: bad argument #2') end
|
||||||
local sp = getNode(s)
|
local sp = getNode(s)
|
||||||
local tp = getNode(t)
|
local tp = getNode(t)
|
||||||
if sp == tp and sp.fs.copy then
|
if sp == tp and sp.fs.copy then
|
||||||
|
5
sys/help/CloudCatcher
Normal file
5
sys/help/CloudCatcher
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Cloud Catcher is a web terminal for ComputerCraft, allowing you to interact with any in-game computer in the browser, as well as edit files remotely!
|
||||||
|
|
||||||
|
To get started, visit https://cloud-catcher.squiddev.cc/cloud.lua for a session key.
|
||||||
|
|
||||||
|
Within Files, press 'c' to edit a file using Cloud Catcher.
|
Loading…
Reference in New Issue
Block a user