Переглянути джерело

* Fix bug ID #18550

git-svn-id: trunk@27774 -
michael 11 роки тому
батько
коміт
d9d1a7fa5d
1 змінених файлів з 9 додано та 1 видалено
  1. 9 1
      rtl/objpas/sysutils/fina.inc

+ 9 - 1
rtl/objpas/sysutils/fina.inc

@@ -18,13 +18,21 @@ function ChangeFileExt(const FileName, Extension: PathStr): PathStr;
 var
   i : longint;
   EndSep : Set of Char;
+  SOF : Boolean;
+  
 begin
   i := Length(FileName);
   EndSep:=AllowDirectorySeparators+AllowDriveSeparators+[ExtensionSeparator];
   while (I > 0) and not(FileName[I] in EndSep) do
     Dec(I);
   if (I = 0) or (FileName[I] <> ExtensionSeparator) then
-    I := Length(FileName)+1;
+    I := Length(FileName)+1
+  else
+    begin
+	SOF:=(I=1) or (FileName[i-1] in AllowDirectorySeparators);
+  	if (SOF) and not FirstDotAtFileNameStartIsExtension then
+	  I:=Length(FileName)+1;
+	end;  
   Result := Copy(FileName, 1, I - 1) + Extension;
 end;