mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-12-22 13:16:52 +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
|
||||
|
||||
-- function love.load()
|
||||
-- -- readPXM('Pole.pxm')
|
||||
-- -- readTSC('Pole.tsc', 'Testing.tsc')
|
||||
-- -- writeTSC('Testing.tsc')
|
||||
-- -- readTSC('TestingEncoded.tsc', 'TestingDecoded.tsc')
|
||||
-- local sourcePath = lf.getSourceBaseDirectory()
|
||||
-- local info = lf.getInfo(sourcePath .. '/data')
|
||||
-- local items = lf.getDirectoryItems(sourcePath)
|
||||
-- print(Serpent.block(items))
|
||||
-- print(Serpent.block(info))
|
||||
-- if info == nil then
|
||||
-- print()
|
||||
-- end
|
||||
-- end
|
||||
|
||||
function love.directorydropped(path)
|
||||
|
@ -66,9 +70,15 @@ function love.directorydropped(path)
|
|||
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.
|
||||
for filename, tscFile in pairs(tscFiles) do
|
||||
local path = '/data/Stage/' .. filename
|
||||
local path = sourcePath .. '/data/Stage/' .. filename
|
||||
tscFile:writeTo(path)
|
||||
end
|
||||
|
||||
|
|
|
@ -63,13 +63,11 @@ function C:replaceItem(replacement)
|
|||
end
|
||||
|
||||
function C:writeTo(path)
|
||||
local encoded = self:_codec(self._text, 'encode')
|
||||
logInfo('writing TSC to: ' .. path)
|
||||
|
||||
local filepath = lf.getSourceBaseDirectory() .. path
|
||||
logInfo('writing TSC to: ' .. filepath)
|
||||
|
||||
local file, err = io.open(filepath, MODE_WRITE_ERASE_EXISTING)
|
||||
local file, err = io.open(path, MODE_WRITE_ERASE_EXISTING)
|
||||
assert(err == nil, err)
|
||||
local encoded = self:_codec(self._text, 'encode')
|
||||
file:write(encoded)
|
||||
file:flush()
|
||||
file:close()
|
||||
|
|
Loading…
Reference in a new issue