mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-19 00:59:25 +02:00
improved case renaming of pascal files
git-svn-id: trunk@3404 -
This commit is contained in:
parent
ca3b7a17ce
commit
d4f67913c0
@ -93,6 +93,8 @@ function CopyDirectoryWithMethods(const SrcDirectory, DestDirectory: string;
|
|||||||
OnCopyFile: TOnCopyFileMethod; OnCopyError: TOnCopyErrorMethod;
|
OnCopyFile: TOnCopyFileMethod; OnCopyError: TOnCopyErrorMethod;
|
||||||
Data: TObject): boolean;
|
Data: TObject): boolean;
|
||||||
function ProgramDirectory: string;
|
function ProgramDirectory: string;
|
||||||
|
function FindFilesCaseInsensitive(const Directory,
|
||||||
|
CaseInsensitiveFilename: string; IgnoreExact: boolean): TStringList;
|
||||||
|
|
||||||
// XMLConfig
|
// XMLConfig
|
||||||
procedure LoadRecentList(XMLConfig: TXMLConfig; List: TStringList;
|
procedure LoadRecentList(XMLConfig: TXMLConfig; List: TStringList;
|
||||||
@ -150,6 +152,13 @@ uses
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$EndIf};
|
{$EndIf};
|
||||||
|
|
||||||
|
const
|
||||||
|
{$IFDEF Win32}
|
||||||
|
FindMask = '*.*';
|
||||||
|
{$ELSE}
|
||||||
|
FindMask = '*';
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
function AddToRecentList(const s: string; RecentList: TStringList;
|
function AddToRecentList(const s: string; RecentList: TStringList;
|
||||||
Max: integer): boolean;
|
Max: integer): boolean;
|
||||||
begin
|
begin
|
||||||
@ -182,6 +191,37 @@ begin
|
|||||||
SaveStringList(XMLConfig,List,Path);
|
SaveStringList(XMLConfig,List,Path);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{-------------------------------------------------------------------------------
|
||||||
|
function FindFilesCaseInsensitive(const Directory,
|
||||||
|
CaseInsensitiveFilename: string; IgnoreExact: boolean): TStringLists;
|
||||||
|
|
||||||
|
Search case insensitive in Directory for all files
|
||||||
|
named CaseInsensitiveFilename
|
||||||
|
-------------------------------------------------------------------------------}
|
||||||
|
function FindFilesCaseInsensitive(const Directory,
|
||||||
|
CaseInsensitiveFilename: string; IgnoreExact: boolean): TStringList;
|
||||||
|
var
|
||||||
|
FileInfo: TSearchRec;
|
||||||
|
begin
|
||||||
|
Result:=nil;
|
||||||
|
if SysUtils.FindFirst(AppendPathDelim(Directory)+FindMask,
|
||||||
|
faAnyFile,FileInfo)=0
|
||||||
|
then begin
|
||||||
|
repeat
|
||||||
|
// check if special file
|
||||||
|
if (FileInfo.Name='.') or (FileInfo.Name='..') then continue;
|
||||||
|
if (AnsiCompareText(CaseInsensitiveFilename,FileInfo.Name)=0)
|
||||||
|
and ((not IgnoreExact)
|
||||||
|
or (CaseInsensitiveFilename<>FileInfo.Name))
|
||||||
|
then begin
|
||||||
|
if Result=nil then Result:=TStringList.Create;
|
||||||
|
Result.Add(FileInfo.Name);
|
||||||
|
end;
|
||||||
|
until SysUtils.FindNext(FileInfo)<>0;
|
||||||
|
end;
|
||||||
|
SysUtils.FindClose(FileInfo);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure LoadRecentList(XMLConfig: TXMLConfig; List: TStringList;
|
procedure LoadRecentList(XMLConfig: TXMLConfig; List: TStringList;
|
||||||
const Path: string);
|
const Path: string);
|
||||||
begin
|
begin
|
||||||
@ -1152,12 +1192,6 @@ function CopyDirectoryWithMethods(const SrcDirectory, DestDirectory: string;
|
|||||||
|
|
||||||
function CopyDir(const CurSrcDir, CurDestDir: string): boolean;
|
function CopyDir(const CurSrcDir, CurDestDir: string): boolean;
|
||||||
// both dirs must end with PathDelim
|
// both dirs must end with PathDelim
|
||||||
const
|
|
||||||
{$IFDEF Win32}
|
|
||||||
FindMask = '*.*';
|
|
||||||
{$ELSE}
|
|
||||||
FindMask = '*';
|
|
||||||
{$ENDIF}
|
|
||||||
var
|
var
|
||||||
FileInfo: TSearchRec;
|
FileInfo: TSearchRec;
|
||||||
CurFilename,
|
CurFilename,
|
||||||
|
Loading…
Reference in New Issue
Block a user