Commit 68b3c68d authored by Fayti1703's avatar Fayti1703 Committed by duncathan salt

Fix *nix mkdir

Also extracts the mkdir code into its own function, in case we need to modify it again
parent 57871e0e
......@@ -16,6 +16,16 @@ do
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()
self._isCaveStoryPlus = false
self.itemDeck = Items()
......@@ -90,8 +100,7 @@ function C:_writePlaintext(tscFiles)
local sourcePath = lf.getSourceBaseDirectory()
-- Create /data/Plaintext if it doesn't already exist.
local command = ('mkdir "%s"'):format(sourcePath .. '/data/Plaintext')
os.execute(command) -- HERE BE DRAGONS!!!
mkdir(sourcePath .. '/data/Plaintext')
-- Write modified files.
for filename, tscFile in pairs(tscFiles) do
......@@ -186,8 +195,7 @@ function C:_getWritePaths()
and (self._writePath .. '/base/Stage')
or (self._writePath .. '/Stage')
-- Create /data(/base)/Stage if it doesn't already exist.
local command = ('mkdir "%s"'):format(self._writePathStage)
os.execute(command) -- HERE BE DRAGONS!!!
mkdir(self._writePathStage)
end
return self._writePath, self._writePathStage
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment