diff --git a/lcl/include/fileutil.inc b/lcl/include/fileutil.inc index 8b09e29257..9e608202d8 100644 --- a/lcl/include/fileutil.inc +++ b/lcl/include/fileutil.inc @@ -621,7 +621,7 @@ begin while (p>0) do begin case Result[p] of PathDelim: exit; - '.': Result:=copy(Result,1, p-1); + '.': exit(copy(Result,1, p-1)); end; dec(p); end; diff --git a/test/bugs/testfileutil.pas b/test/bugs/testfileutil.pas index 158d40f5e1..346f88d455 100644 --- a/test/bugs/testfileutil.pas +++ b/test/bugs/testfileutil.pas @@ -44,10 +44,10 @@ var end; begin DoTest('test.pas', 'test'); - DoTest('test.pas.bak', 'test'); + DoTest('test.pas.bak', 'test.pas'); DirName := AppendPathDelim('testdir'); DoTest(DirName + 'test.pas', DirName + 'test'); - DoTest(DirName + 'test.pas.bak', DirName + 'test'); + DoTest(DirName + 'test.pas.bak', DirName + 'test.pas'); end; procedure TTestFileUtil.TestTrimFileName;