Skip to content

Commit

Permalink
Fixed the issue with length of modPath being weird in some cases
Browse files Browse the repository at this point in the history
joinpath could end up with double separators on Windows as a combination of \ and /
The filename that is being sliced does not have these doubles, causing a missmatch that would leave a leading slash in some cases
  • Loading branch information
Cruor committed Sep 2, 2022
1 parent 94191b6 commit 2bb9ade
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/ui/forms/fields/path.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ local function openFileDialog(textField, options)
return false
end

filename = string.sub(filename, #modPath + 1)
filename = string.sub(filename, #modPath + 2)
end

if usingWindows and useUnixSeparator ~= false then
Expand Down Expand Up @@ -104,6 +104,9 @@ function pathField.getElement(name, value, options)

prefix = modPath
filename = utils.joinpath(modPath, filename)

-- Has to use unix paths for Love2d to detect the file
filename = utils.convertToUnixPath(filename)
end

if filenameResolver then
Expand Down

0 comments on commit 2bb9ade

Please sign in to comment.