summaryrefslogtreecommitdiffstatshomepage
path: root/plugins
diff options
context:
space:
mode:
author npwoods <npwoods@mess.org>2022-12-16 14:03:59 -0500
committer GitHub <noreply@github.com>2022-12-17 06:03:59 +1100
commit13910382a5e846677f30d1645bfb44e4983de557 (patch)
treebc75e208d5dc4305a6721dff63efaec2864db178 /plugins
parent14c3d33e86ceeeeb57c44cb7d6aa85685f79813a (diff)
osd/modules/file: Don't magically substitute environment variables when opening files. (#9859)
* util/options.cpp: Added option types for single and multiple paths. * util/options.cpp: Substitute environment variables in values from defaults and INI files. * ui/dirmenu.cpp: Removed hard-coded list of multi-path options. * plugins: Don't substitute environment variables in path options.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/autofire/autofire_save.lua2
-rw-r--r--plugins/boot.lua2
-rw-r--r--plugins/cheat/init.lua4
-rw-r--r--plugins/cheatfind/init.lua2
-rw-r--r--plugins/console/init.lua2
-rw-r--r--plugins/data/data_hiscore.lua6
-rw-r--r--plugins/data/database.lua4
-rw-r--r--plugins/hiscore/init.lua2
-rw-r--r--plugins/inputmacro/inputmacro_persist.lua2
-rw-r--r--plugins/portname/init.lua2
-rw-r--r--plugins/timecode/init.lua2
-rw-r--r--plugins/timer/timer_persist.lua2
12 files changed, 16 insertions, 16 deletions
diff --git a/plugins/autofire/autofire_save.lua b/plugins/autofire/autofire_save.lua
index 5ca4cd217b6..52586c461ad 100644
--- a/plugins/autofire/autofire_save.lua
+++ b/plugins/autofire/autofire_save.lua
@@ -1,7 +1,7 @@
local lib = {}
local function get_settings_path()
- return emu.subst_env(manager.machine.options.entries.homepath:value():match('([^;]+)')) .. '/autofire'
+ return manager.machine.options.entries.homepath:value():match('([^;]+)') .. '/autofire'
end
local function get_settings_filename()
diff --git a/plugins/boot.lua b/plugins/boot.lua
index 712fe0db7c6..390ce652ff6 100644
--- a/plugins/boot.lua
+++ b/plugins/boot.lua
@@ -8,7 +8,7 @@ _G.N_ = function (message) return message end
_G.N_p = function (context, message) return message end
_G.emu.plugin = {} -- table to contain plugin interfaces
-- substitute environment variables in the plugins path from options
-local dirs = emu.subst_env(manager.options.entries.pluginspath:value())
+local dirs = manager.options.entries.pluginspath:value()
-- and split the paths apart and make them suitable for package.path
package.path = ""
diff --git a/plugins/cheat/init.lua b/plugins/cheat/init.lua
index 896fc1e101b..47d7db26cc2 100644
--- a/plugins/cheat/init.lua
+++ b/plugins/cheat/init.lua
@@ -130,7 +130,7 @@ function cheat.startplugin()
local function load_hotkeys()
local json = require("json")
- local file = io.open(emu.subst_env(manager.machine.options.entries.cheatpath:value():match("([^;]+)")) .. "/" .. cheatname .. "_hotkeys.json", "r")
+ local file = io.open(manager.machine.options.entries.cheatpath:value():match("([^;]+)") .. "/" .. cheatname .. "_hotkeys.json", "r")
if not file then
return
end
@@ -154,7 +154,7 @@ function cheat.startplugin()
end
end
end
- local path = emu.subst_env(manager.machine.options.entries.cheatpath:value():match("([^;]+)"))
+ local path = manager.machine.options.entries.cheatpath:value():match("([^;]+)")
local filepath = path .. "/" .. cheatname .. "_hotkeys.json"
if #hotkeys > 0 then
local json = require("json")
diff --git a/plugins/cheatfind/init.lua b/plugins/cheatfind/init.lua
index 96617e12fb6..7c3cea73e8b 100644
--- a/plugins/cheatfind/init.lua
+++ b/plugins/cheatfind/init.lua
@@ -965,7 +965,7 @@ function cheatfind.startplugin()
end
end
end
- cheat_save.path = emu.subst_env(manager.machine.options.entries.cheatpath:value()):match("([^;]+)")
+ cheat_save.path = manager.machine.options.entries.cheatpath:value():match("([^;]+)")
cheat_save.filename = string.format("%s/%s", cheat_save.path, setname)
cheat_save.name = cheat.desc
local json = require("json")
diff --git a/plugins/console/init.lua b/plugins/console/init.lua
index 6b8643fe168..1b40ac50bee 100644
--- a/plugins/console/init.lua
+++ b/plugins/console/init.lua
@@ -243,7 +243,7 @@ function console.startplugin()
end
if (not started) then
-- options are not available in startplugin, so we load the history here
- local homepath = emu.subst_env(manager.options.entries.homepath:value():match("([^;]+)"))
+ local homepath = manager.options.entries.homepath:value():match("([^;]+)")
history_fullpath = homepath .. '/' .. history_file
ln.loadhistory(history_fullpath)
started = true
diff --git a/plugins/data/data_hiscore.lua b/plugins/data/data_hiscore.lua
index c0794b20195..f05e4ddd173 100644
--- a/plugins/data/data_hiscore.lua
+++ b/plugins/data/data_hiscore.lua
@@ -5,7 +5,7 @@ local dat = {}
local env = {}
local output
local curset
-local path = emu.subst_env(mame_manager.ui.options.entries.historypath:value():gsub("([^;]+)", "%1/hi2txt"))
+local path = mame_manager.ui.options.entries.historypath:value():gsub("([^;]+)", "%1/hi2txt")
local htmlentites = {
["amp"] = "&",
["quot"] = utf8.char(34),
@@ -355,7 +355,7 @@ local htmlentites = {
function env.open(file, size, swap)
if file == ".hi" then
local path = "hi"
- local ini = emu.file(emu.subst_env(manager.options.entries.inipath:value()), 1)
+ local ini = emu.file(manager.options.entries.inipath:value(), 1)
local ret = ini:open("hiscore.ini")
if not ret then
local inifile = ini:read(ini:size())
@@ -369,7 +369,7 @@ function env.open(file, size, swap)
end
file = path .. "/" .. curset .. ".hi"
else
- file = emu.subst_env(manager.options.entries.nvram_directory:value()) .. "/" .. curset .. "/" .. file
+ file = manager.options.entries.nvram_directory:value() .. "/" .. curset .. "/" .. file
end
local f = io.open(file, "rb")
local content = f:read("*all")
diff --git a/plugins/data/database.lua b/plugins/data/database.lua
index e0249182409..4fb4eaa2ddf 100644
--- a/plugins/data/database.lua
+++ b/plugins/data/database.lua
@@ -10,7 +10,7 @@ local function check_db_result(msg)
end
local function settings_path()
- return emu.subst_env(manager.machine.options.entries.homepath:value():match('([^;]+)')) .. '/data'
+ return manager.machine.options.entries.homepath:value():match('([^;]+)') .. '/data'
end
local function check_version_table()
@@ -147,7 +147,7 @@ end
function dbtable.open_data_file(file)
local fh, filepath
for path in mame_manager.ui.options.entries.historypath:value():gmatch('([^;]+)') do
- filepath = emu.subst_env(path) .. '/' .. file
+ filepath = path .. '/' .. file
fh = io.open(filepath, 'r')
if fh then
break
diff --git a/plugins/hiscore/init.lua b/plugins/hiscore/init.lua
index 652061c92cf..5f93b91bd1a 100644
--- a/plugins/hiscore/init.lua
+++ b/plugins/hiscore/init.lua
@@ -23,7 +23,7 @@ end
function hiscore.startplugin()
local function get_data_path()
- return emu.subst_env(manager.machine.options.entries.homepath:value():match('([^;]+)')) .. '/hiscore'
+ return manager.machine.options.entries.homepath:value():match('([^;]+)') .. '/hiscore'
end
-- configuration
diff --git a/plugins/inputmacro/inputmacro_persist.lua b/plugins/inputmacro/inputmacro_persist.lua
index 6c2aa6fd188..6519f3a048a 100644
--- a/plugins/inputmacro/inputmacro_persist.lua
+++ b/plugins/inputmacro/inputmacro_persist.lua
@@ -5,7 +5,7 @@
-- Helpers
local function settings_path()
- return emu.subst_env(manager.machine.options.entries.homepath:value():match('([^;]+)')) .. '/inputmacro'
+ return manager.machine.options.entries.homepath:value():match('([^;]+)') .. '/inputmacro'
end
local function settings_filename()
diff --git a/plugins/portname/init.lua b/plugins/portname/init.lua
index 1f2c8d80874..b855f27cc6e 100644
--- a/plugins/portname/init.lua
+++ b/plugins/portname/init.lua
@@ -28,7 +28,7 @@ local portname = exports
function portname.startplugin()
local json = require("json")
- local ctrlrpath = emu.subst_env(manager.options.entries.ctrlrpath:value():match("([^;]+)"))
+ local ctrlrpath = manager.options.entries.ctrlrpath:value():match("([^;]+)")
local function get_filename(nosoft)
local filename
if emu.softname() ~= "" and not nosoft then
diff --git a/plugins/timecode/init.lua b/plugins/timecode/init.lua
index 09e49229cae..93435ef2870 100644
--- a/plugins/timecode/init.lua
+++ b/plugins/timecode/init.lua
@@ -34,7 +34,7 @@ function timecode.startplugin()
local function get_settings_path()
- return emu.subst_env(manager.machine.options.entries.homepath:value():match('([^;]+)')) .. '/timecode'
+ return manager.machine.options.entries.homepath:value():match('([^;]+)') .. '/timecode'
end
diff --git a/plugins/timer/timer_persist.lua b/plugins/timer/timer_persist.lua
index 4781c263ba8..cb24b485dcb 100644
--- a/plugins/timer/timer_persist.lua
+++ b/plugins/timer/timer_persist.lua
@@ -130,7 +130,7 @@ end
local function open_database()
-- make sure settings directory exists
- local dir = emu.subst_env(manager.machine.options.entries.homepath:value():match('([^;]+)')) .. '/timer'
+ local dir = manager.machine.options.entries.homepath:value():match('([^;]+)') .. '/timer'
local attr = lfs.attributes(dir)
if not attr then
lfs.mkdir(dir)