diff --git a/src/base/path.lua b/src/base/path.lua index 02d919d0..28aa8b3f 100644 --- a/src/base/path.lua +++ b/src/base/path.lua @@ -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 diff --git a/tests/base/test_path.lua b/tests/base/test_path.lua index 8c30ee6b..953dfd87 100755 --- a/tests/base/test_path.lua +++ b/tests/base/test_path.lua @@ -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