File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,14 @@ local info = Util.info
8
8
local Map = {}
9
9
Map .__index = Map
10
10
11
+ local function expand_tilde (path )
12
+ if path :find (" ^~" ) ~= nil then
13
+ return format (" %s%s" , os.getenv (" HOME" ), path :sub (2 ))
14
+ else
15
+ return path
16
+ end
17
+ end
18
+
11
19
function Map .new (name )
12
20
local ret = setmetatable ({}, Map )
13
21
@@ -137,6 +145,7 @@ function Map:save(path, suffix)
137
145
local area_count = table_len (self .areas )
138
146
local obj = {}
139
147
local data_to_save = false
148
+ path = expand_tilde (path )
140
149
local fname = format (" %s.map_%s%s.lua" , path , self .name , suffix )
141
150
info (" MAP" , format (" Saving to '%s'" , fname ))
142
151
if area_count > 10 then
165
174
function Map :load (path , suffix )
166
175
self .areas = {}
167
176
suffix = suffix or " "
177
+ path = expand_tilde (path )
168
178
local fname = format (" %s.map_%s%s.lua" , path , self .name , suffix )
169
179
info (" MAP" , format (" Loading from '%s'" , fname ))
170
180
local ok , obj = false , {}
You can’t perform that action at this time.
0 commit comments