bugfix: creating wav file on first run
We need to ensure the save dir exists. But it only gets created in calls to love.filesystem.
This commit is contained in:
parent
d94dd8671e
commit
be2335a15c
5
wav.lua
5
wav.lua
|
@ -23,8 +23,11 @@ wav = {
|
|||
if type(filename) ~= "string" then
|
||||
error("invalid function parameter, expected string filename", 2)
|
||||
end
|
||||
local absolute_path = love.filesystem.getSaveDirectory()..'/'..filename
|
||||
-- ensure directory exists
|
||||
love.filesystem.write(absolute_path, '')
|
||||
-- Audio file handle
|
||||
local file = io.open(love.filesystem.getSaveDirectory()..'/'..filename, "wb")
|
||||
local file = io.open(absolute_path, "wb")
|
||||
if not file then
|
||||
error(string.format("couldn't open file %q", filename), 2)
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue