mirror of
https://github.com/EngineerSmith/nativefs.git
synced 2025-11-08 23:15:02 +00:00
fix absolute path handling in createDirectory
This commit is contained in:
@@ -318,7 +318,7 @@ function nativefs.getDriveList()
|
||||
end
|
||||
|
||||
function nativefs.createDirectory(path)
|
||||
local current = ''
|
||||
local current = path:sub(1, 1) == '/' and '/' or ''
|
||||
for dir in path:gmatch('[^/\\]+') do
|
||||
current = current .. dir .. '/'
|
||||
local info = nativefs.getInfo(current, 'directory')
|
||||
|
||||
@@ -223,6 +223,7 @@ end
|
||||
|
||||
function test_fs_createDirectory()
|
||||
notFailed(fs.createDirectory('data/a/b/c/defg/h'))
|
||||
notEquals(fs.getInfo('data/a/b/c/defg/h'), nil)
|
||||
fs.remove('data/a/b/c/defg/h')
|
||||
fs.remove('data/a/b/c/defg')
|
||||
fs.remove('data/a/b/c')
|
||||
@@ -231,6 +232,7 @@ function test_fs_createDirectory()
|
||||
|
||||
local d = fs.getWorkingDirectory() .. '/data/a'
|
||||
notFailed(fs.createDirectory(d))
|
||||
notEquals(fs.getInfo(d), nil)
|
||||
fs.remove(d)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user