mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-11-10 00:45:15 +00:00
Fix *nix mkdir
Also extracts the mkdir code into its own function, in case we need to modify it again
This commit is contained in:
parent
57871e0ef1
commit
68b3c68d92
|
@ -16,6 +16,16 @@ do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function mkdir(path)
|
||||||
|
local mkdir_str
|
||||||
|
if package.config:sub(1,1) == '\\' then -- Windows
|
||||||
|
mkdir_str = 'mkdir "%s"'
|
||||||
|
else -- *nix
|
||||||
|
mkdir_str = "mkdir -p '%s'"
|
||||||
|
end
|
||||||
|
os.execute(mkdir_str:format(path)) -- HERE BE DRAGONS!!!
|
||||||
|
end
|
||||||
|
|
||||||
function C:new()
|
function C:new()
|
||||||
self._isCaveStoryPlus = false
|
self._isCaveStoryPlus = false
|
||||||
self.itemDeck = Items()
|
self.itemDeck = Items()
|
||||||
|
@ -90,8 +100,7 @@ function C:_writePlaintext(tscFiles)
|
||||||
local sourcePath = lf.getSourceBaseDirectory()
|
local sourcePath = lf.getSourceBaseDirectory()
|
||||||
|
|
||||||
-- Create /data/Plaintext if it doesn't already exist.
|
-- Create /data/Plaintext if it doesn't already exist.
|
||||||
local command = ('mkdir "%s"'):format(sourcePath .. '/data/Plaintext')
|
mkdir(sourcePath .. '/data/Plaintext')
|
||||||
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
|
||||||
|
@ -186,8 +195,7 @@ function C:_getWritePaths()
|
||||||
and (self._writePath .. '/base/Stage')
|
and (self._writePath .. '/base/Stage')
|
||||||
or (self._writePath .. '/Stage')
|
or (self._writePath .. '/Stage')
|
||||||
-- Create /data(/base)/Stage if it doesn't already exist.
|
-- Create /data(/base)/Stage if it doesn't already exist.
|
||||||
local command = ('mkdir "%s"'):format(self._writePathStage)
|
mkdir(self._writePathStage)
|
||||||
os.execute(command) -- HERE BE DRAGONS!!!
|
|
||||||
end
|
end
|
||||||
return self._writePath, self._writePathStage
|
return self._writePath, self._writePathStage
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue