Skip to content

Commit dc13ca6

Browse files
authored
Fix parent directory creation for absolute POSIX paths (#9777)
The `[^/]+/` match pattern requires at least on non-slash character before the trailing slash. This works on Windows where absolute paths start with a drive letter. With absolute POSIX paths, the leading slash is skipped by this pattern causing the accumulated `dirStr` to not start with a slash. `dirStr` is then interpreted as a relative path, causing the directories to be erroneously created in the current working directory. This change fixes the erroneous behavior with absolute POSIX paths by initializing `dirStr` with a slash if the `fullPath` starts with a slash. It retains the current behavior on Windows systems.
1 parent 6d574e1 commit dc13ca6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/UpdateCheck.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ local ops = { }
305305
local opsRuntime = { }
306306
for _, data in pairs(updateFiles) do
307307
-- Ensure that the destination path of this file exists
308-
local dirStr = ""
308+
local dirStr = data.fullPath:sub(1,1) == "/" and "/" or ""
309309
for dir in data.fullPath:gmatch("([^/]+/)") do
310310
dirStr = dirStr .. dir
311311
MakeDir(dirStr)

0 commit comments

Comments
 (0)