mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-22 13:39:30 +02:00
LazUtils: Move ExtractFileNameWithoutExt to LazFileUtils. Rhymes with ExtractFileNameOnly.
git-svn-id: trunk@59169 -
This commit is contained in:
parent
03042bfb7d
commit
571647e302
@ -95,24 +95,6 @@ begin
|
||||
Result:=false;
|
||||
end;
|
||||
|
||||
function ExtractFileNameWithoutExt(const AFilename: string): string;
|
||||
var
|
||||
p: Integer;
|
||||
begin
|
||||
Result:=AFilename;
|
||||
p:=length(Result);
|
||||
while (p>0) do begin
|
||||
case Result[p] of
|
||||
PathDelim: exit;
|
||||
{$ifdef windows}
|
||||
'/': if ('/' in AllowDirectorySeparators) then exit;
|
||||
{$endif}
|
||||
'.': exit(copy(Result,1, p-1));
|
||||
end;
|
||||
dec(p);
|
||||
end;
|
||||
end;
|
||||
|
||||
function DeleteDirectory(const DirectoryName: string; OnlyChildren: boolean): boolean;
|
||||
const
|
||||
//Don't follow symlinks on *nix, just delete them
|
||||
|
@ -61,7 +61,6 @@ function ProgramDirectoryWithBundle: string;
|
||||
|
||||
function ExpandUNCFileNameUTF8(const FileName: string): string;
|
||||
function FileSize(const Filename: string): int64; overload; inline;
|
||||
function ExtractFileNameWithoutExt(const AFilename: string): string;
|
||||
function FilenameIsPascalUnit(const Filename: string): boolean;
|
||||
function CreateAbsoluteSearchPath(const SearchPath, BaseDirectory: string): string;
|
||||
function CreateAbsolutePath(const Filename, BaseDirectory: string): string;
|
||||
|
@ -247,7 +247,7 @@ end;
|
||||
}
|
||||
|
||||
function TryCreateRelativePath(const Dest, Source: String; UsePointDirectory: boolean;
|
||||
AlwaysRequireSharedBaseFolder: Boolean; out RelPath: String): Boolean;
|
||||
AlwaysRequireSharedBaseFolder: Boolean; out RelPath: String): Boolean;
|
||||
Const
|
||||
MaxDirs = 129;
|
||||
Type
|
||||
@ -416,7 +416,7 @@ begin
|
||||
end;
|
||||
|
||||
function CreateRelativePath(const Filename, BaseDirectory: string;
|
||||
UsePointDirectory: boolean; AlwaysRequireSharedBaseFolder: Boolean): string;
|
||||
UsePointDirectory: boolean; AlwaysRequireSharedBaseFolder: Boolean): string;
|
||||
var
|
||||
RelPath: String;
|
||||
begin
|
||||
|
@ -29,9 +29,7 @@ uses
|
||||
function CompareFilenames(const Filename1, Filename2: string): integer; overload;
|
||||
function CompareFilenamesIgnoreCase(const Filename1, Filename2: string): integer;
|
||||
function CompareFileExt(const Filename, Ext: string;
|
||||
CaseSensitive: boolean): integer; overload;
|
||||
function CompareFileExt(const Filename, Ext: string): integer; overload;
|
||||
|
||||
CaseSensitive: boolean = False): integer;
|
||||
function CompareFilenameStarts(const Filename1, Filename2: string): integer;
|
||||
function CompareFilenames(Filename1: PChar; Len1: integer;
|
||||
Filename2: PChar; Len2: integer): integer; overload;
|
||||
@ -42,6 +40,7 @@ function CompareFilenamesP(Filename1, Filename2: PChar;
|
||||
function DirPathExists(DirectoryName: string): boolean;
|
||||
function DirectoryIsWritable(const DirectoryName: string): boolean;
|
||||
function ExtractFileNameOnly(const AFilename: string): string;
|
||||
function ExtractFileNameWithoutExt(const AFilename: string): string;
|
||||
function FilenameIsAbsolute(const TheFilename: string):boolean;
|
||||
function FilenameIsWinAbsolute(const TheFilename: string):boolean;
|
||||
function FilenameIsUnixAbsolute(const TheFilename: string):boolean;
|
||||
@ -64,9 +63,9 @@ function CleanAndExpandDirectory(const Filename: string): string; // empty strin
|
||||
function TrimAndExpandFilename(const Filename: string; const BaseDir: string = ''): string; // empty string returns empty string
|
||||
function TrimAndExpandDirectory(const Filename: string; const BaseDir: string = ''): string; // empty string returns empty string
|
||||
function TryCreateRelativePath(const Dest, Source: String; UsePointDirectory: boolean;
|
||||
AlwaysRequireSharedBaseFolder: Boolean; out RelPath: String): Boolean;
|
||||
AlwaysRequireSharedBaseFolder: Boolean; out RelPath: String): Boolean;
|
||||
function CreateRelativePath(const Filename, BaseDirectory: string;
|
||||
UsePointDirectory: boolean = false; AlwaysRequireSharedBaseFolder: Boolean = True): string;
|
||||
UsePointDirectory: boolean = false; AlwaysRequireSharedBaseFolder: Boolean = True): string;
|
||||
function FileIsInPath(const Filename, Path: string): boolean;
|
||||
|
||||
type
|
||||
@ -294,11 +293,6 @@ begin
|
||||
if Result > 0 then Result := 1;
|
||||
end;
|
||||
|
||||
function CompareFileExt(const Filename, Ext: string): integer;
|
||||
begin
|
||||
Result := CompareFileExt(Filename, Ext, False);
|
||||
end;
|
||||
|
||||
function ExtractFileNameOnly(const AFilename: string): string;
|
||||
var
|
||||
StartPos: Integer;
|
||||
@ -317,6 +311,24 @@ begin
|
||||
Result:=copy(AFilename,StartPos,ExtPos-StartPos);
|
||||
end;
|
||||
|
||||
function ExtractFileNameWithoutExt(const AFilename: string): string;
|
||||
var
|
||||
p: Integer;
|
||||
begin
|
||||
Result:=AFilename;
|
||||
p:=length(Result);
|
||||
while (p>0) do begin
|
||||
case Result[p] of
|
||||
PathDelim: exit;
|
||||
{$ifdef windows}
|
||||
'/': if ('/' in AllowDirectorySeparators) then exit;
|
||||
{$endif}
|
||||
'.': exit(copy(Result,1, p-1));
|
||||
end;
|
||||
dec(p);
|
||||
end;
|
||||
end;
|
||||
|
||||
{$IFDEF darwin}
|
||||
function GetDarwinSystemFilename(Filename: string): string;
|
||||
var
|
||||
|
Loading…
Reference in New Issue
Block a user