Skip to content

Commit

Permalink
Fixes for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
rollerozxa committed May 29, 2023
1 parent 1747f68 commit b9c1216
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion builtin/mainmenu/settings/components.lua
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ function make.path(setting)
self.changed = value ~= setting.default

local fs = ("field[0,0.3;%f,0.8;%s;%s;%s]"):format(
avail_w - 3, setting.name, get_label(setting), value)
avail_w - 3, setting.name, get_label(setting), core.formspec_escape(value))
fs = fs .. ("button[%f,0.3;1.5,0.8;%s;%s]"):format(avail_w - 3, "pick_" .. setting.name, fgettext("Browse"))
fs = fs .. ("button[%f,0.3;1.5,0.8;%s;%s]"):format(avail_w - 1.5, "set_" .. setting.name, fgettext("Set"))

Expand Down
10 changes: 7 additions & 3 deletions builtin/mainmenu/settings/dlg_file_browser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

local PATH = os.getenv("HOME") or os.getenv("HOMEPATH") or core.get_user_path()
local PATH = os.getenv("HOME") -- Linux & similar
or os.getenv("HOMEDRIVE") .. os.getenv("HOMEPATH") -- Windows
or core.get_user_path() -- If nothing else works

tabdata = {}

Expand Down Expand Up @@ -70,7 +72,7 @@ local function make_fs(dialogdata)
"formspec_version[4]",
"size[14,9.2]",
"image_button[0.2,0.2;0.65,0.65;", texture('up_icon'), ";updir;]",
"field[1,0.2;12,0.65;path;;", PATH, "]",
"field[1,0.2;12,0.65;path;;", core.formspec_escape(PATH), "]",
"tablecolumns[image,",
"0=", texture('folder'), ",",
"1=", texture('file'), ",",
Expand Down Expand Up @@ -129,7 +131,9 @@ local function fields_handler(this, fields)
PATH = string.split(PATH, DIR_DELIM)
PATH[#PATH] = nil
PATH = table.concat(PATH, DIR_DELIM)
PATH = DIR_DELIM .. PATH
if not PLATFORM == "Windows" then
PATH = DIR_DELIM .. PATH
end

tabdata.selected = 1

Expand Down

0 comments on commit b9c1216

Please sign in to comment.