Fix replaceextension from adding a leading dot
When an empty string was passed to replaceextension as the new extension, it added a leading dot, this update fixes/prevents it.
This commit is contained in:
parent
82fd64e00c
commit
9d068901f9
@ -231,7 +231,7 @@
|
||||
return p
|
||||
end
|
||||
|
||||
if not newext:findlast(".", true) then
|
||||
if #newext > 0 and not newext:findlast(".", true) then
|
||||
newext = "."..newext
|
||||
end
|
||||
|
||||
|
@ -420,6 +420,10 @@
|
||||
function suite.getabsolute_replaceExtensionWithoutExtension()
|
||||
test.isequal("/nunit/framework/main.foo", path.replaceextension("/nunit/framework/main",".foo"))
|
||||
end
|
||||
|
||||
function suite.getabsolute_replaceExtensionWithEmptyString()
|
||||
test.isequal("foo", path.replaceextension("foo.lua",""))
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user