|
@@ -105,13 +105,20 @@ function ExtractFileExt(const FileName: PathStr): PathStr;
|
|
var
|
|
var
|
|
i : longint;
|
|
i : longint;
|
|
EndSep : Set of Char;
|
|
EndSep : Set of Char;
|
|
|
|
+ SOF : Boolean; // Dot at Start of filename ?
|
|
|
|
+
|
|
begin
|
|
begin
|
|
|
|
+ Result:='';
|
|
I := Length(FileName);
|
|
I := Length(FileName);
|
|
EndSep:=AllowDirectorySeparators+AllowDriveSeparators+[ExtensionSeparator];
|
|
EndSep:=AllowDirectorySeparators+AllowDriveSeparators+[ExtensionSeparator];
|
|
while (I > 0) and not CharInSet(FileName[I],EndSep) do
|
|
while (I > 0) and not CharInSet(FileName[I],EndSep) do
|
|
Dec(I);
|
|
Dec(I);
|
|
if (I > 0) and (FileName[I] = ExtensionSeparator) then
|
|
if (I > 0) and (FileName[I] = ExtensionSeparator) then
|
|
- Result := Copy(FileName, I, MaxInt)
|
|
|
|
|
|
+ begin
|
|
|
|
+ SOF:=(I=1) or (FileName[i-1] in AllowDirectorySeparators);
|
|
|
|
+ if (Not SOF) or FirstDotAtFileNameStartIsExtension then
|
|
|
|
+ Result := Copy(FileName, I, MaxInt);
|
|
|
|
+ end
|
|
else
|
|
else
|
|
Result := '';
|
|
Result := '';
|
|
end;
|
|
end;
|