mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-12-22 21:26:45 +00:00
Distributed version works now, hopefully!
This commit is contained in:
parent
c1f466af8e
commit
5fffdcc659
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
data/*
|
20
src/main.lua
20
src/main.lua
|
@ -30,10 +30,14 @@ do
|
||||||
end
|
end
|
||||||
|
|
||||||
-- function love.load()
|
-- function love.load()
|
||||||
-- -- readPXM('Pole.pxm')
|
-- local sourcePath = lf.getSourceBaseDirectory()
|
||||||
-- -- readTSC('Pole.tsc', 'Testing.tsc')
|
-- local info = lf.getInfo(sourcePath .. '/data')
|
||||||
-- -- writeTSC('Testing.tsc')
|
-- local items = lf.getDirectoryItems(sourcePath)
|
||||||
-- -- readTSC('TestingEncoded.tsc', 'TestingDecoded.tsc')
|
-- print(Serpent.block(items))
|
||||||
|
-- print(Serpent.block(info))
|
||||||
|
-- if info == nil then
|
||||||
|
-- print()
|
||||||
|
-- end
|
||||||
-- end
|
-- end
|
||||||
|
|
||||||
function love.directorydropped(path)
|
function love.directorydropped(path)
|
||||||
|
@ -66,9 +70,15 @@ function love.directorydropped(path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local sourcePath = lf.getSourceBaseDirectory()
|
||||||
|
|
||||||
|
-- Create /data/Stage if it doesn't already exist.
|
||||||
|
local command = ('mkdir "%s"'):format(sourcePath .. '/data/Stage')
|
||||||
|
os.execute(command) -- HERE BE DRAGONS!!!
|
||||||
|
|
||||||
-- Write modified files.
|
-- Write modified files.
|
||||||
for filename, tscFile in pairs(tscFiles) do
|
for filename, tscFile in pairs(tscFiles) do
|
||||||
local path = '/data/Stage/' .. filename
|
local path = sourcePath .. '/data/Stage/' .. filename
|
||||||
tscFile:writeTo(path)
|
tscFile:writeTo(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -63,13 +63,11 @@ function C:replaceItem(replacement)
|
||||||
end
|
end
|
||||||
|
|
||||||
function C:writeTo(path)
|
function C:writeTo(path)
|
||||||
local encoded = self:_codec(self._text, 'encode')
|
logInfo('writing TSC to: ' .. path)
|
||||||
|
|
||||||
local filepath = lf.getSourceBaseDirectory() .. path
|
local file, err = io.open(path, MODE_WRITE_ERASE_EXISTING)
|
||||||
logInfo('writing TSC to: ' .. filepath)
|
|
||||||
|
|
||||||
local file, err = io.open(filepath, MODE_WRITE_ERASE_EXISTING)
|
|
||||||
assert(err == nil, err)
|
assert(err == nil, err)
|
||||||
|
local encoded = self:_codec(self._text, 'encode')
|
||||||
file:write(encoded)
|
file:write(encoded)
|
||||||
file:flush()
|
file:flush()
|
||||||
file:close()
|
file:close()
|
||||||
|
|
Loading…
Reference in a new issue