File tree Expand file tree Collapse file tree 1 file changed +15
-12
lines changed
Expand file tree Collapse file tree 1 file changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -37,28 +37,31 @@ function soluna.set_window_title(text)
3737 mqueue .send (app .mqueue (), ltask .pack (" set_title" , text ))
3838end
3939
40+ local function recursion_mkdir (root , path )
41+ local lfs = require " soluna.lfs"
42+ for p in path :gmatch " [^/\\ ]+" do
43+ root = root .. " /" .. p
44+ lfs .mkdir (root )
45+ end
46+ return (root :gsub (" [^/\\ ]$" , " %0/" ))
47+ end
48+
4049function soluna .gamedir (name )
4150 if name == nil then
4251 settings = settings and soluna .settings ()
4352 name = settings .project or error " missing project name in settings"
4453 end
54+ local lfs = require " soluna.lfs"
55+ local path
4556 if soluna .platform == " windows" then
46- local lfs = require " soluna.lfs"
47- local dir = lfs .personaldir () .. " \\ My Games"
48- lfs .mkdir (dir )
49- dir = dir .. " \\ " .. name
50- lfs .mkdir (dir )
51- return dir .. " \\ "
57+ path = " My Games/"
5258 elseif soluna .platform == " macos" or soluna .platform == " linux" then
53- local lfs = require " soluna.lfs"
54- local dir = lfs .personaldir () .. " /.local/share"
55- lfs .mkdir (dir )
56- dir = dir .. " /" .. name
57- lfs .mkdir (dir )
58- return dir .. " /"
59+ path = " .local/share/"
5960 else
6061 error " TODO: support none windows"
6162 end
63+ path = path .. name
64+ return recursion_mkdir (lfs .personaldir () , path )
6265end
6366
6467function soluna .load_sprites (filename )
You can’t perform that action at this time.
0 commit comments