sanitize waypoint type names with colons for filenames

This commit is contained in:
FaceDeer 2020-11-29 00:47:59 -07:00
parent 528735b4b2
commit 725ddd9b8c

View File

@ -32,7 +32,7 @@ named_waypoints.register_named_waypoints = function(waypoints_type, waypoints_de
waypoint_defs[waypoints_type] = waypoints_def
player_huds[waypoints_type] = {}
local areastore_filename = worldpath.."/named_waypoints_".. waypoints_type ..".txt"
local areastore_filename = worldpath.."/named_waypoints_".. string.gsub(waypoints_type, ":", "_") ..".txt"
local area_file = io.open(areastore_filename, "r")
local areastore = AreaStore()
if area_file then
@ -43,7 +43,7 @@ named_waypoints.register_named_waypoints = function(waypoints_type, waypoints_de
end
local function save(waypoints_type)
local areastore_filename = worldpath.."/named_waypoints_".. waypoints_type ..".txt"
local areastore_filename = worldpath.."/named_waypoints_".. string.gsub(waypoints_type, ":", "_") ..".txt"
local areastore = waypoint_areastores[waypoints_type]
if areastore then
areastore:to_file(areastore_filename)