UPD: Move some code to a separate package so that it can be reused in components or plugins.

This commit is contained in:
cobines 2012-04-09 00:38:34 +00:00
commit 47aec6b94c
153 changed files with 3044 additions and 3675 deletions

View file

@ -1,421 +0,0 @@
{
Double commander
-------------------------------------------------------------------------
This module contains classes with UTF8 file names support.
Copyright (C) 2008-2009 Koblov Alexander (Alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit KASClassesEx;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
const
faInvalidAttributes: Cardinal = Cardinal(-1);
type
{ TFileStreamEx class }
TFileStreamEx = class(THandleStream)
private
FFileName: UTF8String;
public
constructor Create(const AFileName: UTF8String; Mode: Word);
destructor Destroy; override;
property FileName : UTF8String read FFileName;
end;
function mbFileAccess(const FileName: UTF8String; Mode: Integer): Boolean;
function mbFileCreate(const FileName: UTF8String): THandle;
function mbFileOpen(const FileName: UTF8String; Mode: Integer): THandle;
function mbFileExists(const FileName: UTF8String): Boolean;
function mbDeleteFile(const FileName: UTF8String): Boolean;
function mbFileGetAttr(const FileName: UTF8String): Cardinal;
function mbFileSetAttr(const FileName: UTF8String; Attr: Cardinal) : LongInt;
function mbCreateDir(const NewDir: UTF8String): Boolean;
function mbFileSize(const FileName: UTF8String): Int64;
function mbRenameFile(const OldName: UTF8String; NewName: UTF8String): Boolean;
function mbFileSystemEntryExists(const Path: UTF8String): Boolean;
function GetTempName(PathPrefix: String): String;
implementation
uses
RtlConsts
{$IF DEFINED(MSWINDOWS)}
, Windows
{$ELSEIF DEFINED(UNIX)}
, BaseUnix
{$ENDIF}
;
{$IFDEF MSWINDOWS}
const
AccessMode: array[0..2] of DWORD = (
GENERIC_READ,
GENERIC_WRITE,
GENERIC_READ or GENERIC_WRITE);
ShareMode: array[0..4] of DWORD = (
0,
0,
FILE_SHARE_READ,
FILE_SHARE_WRITE,
FILE_SHARE_READ or FILE_SHARE_WRITE);
{$ENDIF}
function mbFileOpen(const FileName: UTF8String; Mode: Integer): THandle;
{$IFDEF MSWINDOWS}
var
wFileName: WideString;
begin
wFileName:= UTF8Decode(FileName);
Result:= CreateFileW(PWChar(wFileName), AccessMode[Mode and 3],
ShareMode[(Mode and $F0) shr 4], nil, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, 0);
end;
{$ELSE}
const
AccessMode: array[0..2] of LongInt = (
O_RdOnly,
O_WrOnly,
O_RdWr);
begin
Result:= fpOpen(FileName, AccessMode[Mode and 3]);
end;
{$ENDIF}
function mbFileAccess(const FileName: UTF8String; Mode: Integer): Boolean;
{$IFDEF MSWINDOWS}
const
AccessMode: array[0..2] of DWORD = (
GENERIC_READ,
GENERIC_WRITE,
GENERIC_READ or GENERIC_WRITE);
var
hFile: System.THandle;
wFileName: WideString;
dwDesiredAccess: DWORD;
dwShareMode: DWORD = 0;
begin
Result:= False;
wFileName:= UTF8Decode(FileName);
dwDesiredAccess := AccessMode[Mode and 3];
if dwDesiredAccess = GENERIC_READ then
dwShareMode := FILE_SHARE_READ;
hFile:= CreateFileW(PWChar(wFileName), dwDesiredAccess, dwShareMode,
nil, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if hFile <> INVALID_HANDLE_VALUE then
begin
Result:= True;
FileClose(hFile);
end;
end;
{$ELSE}
const
AccessMode: array[0..2] of LongInt = (
R_OK,
W_OK,
R_OK or W_OK);
begin
Result:= fpAccess(UTF8ToSys(FileName), AccessMode[Mode and 3]) = 0;
end;
{$ENDIF}
function mbFileCreate(const FileName: UTF8String): THandle;
{$IFDEF MSWINDOWS}
var
wFileName: WideString;
begin
wFileName:= UTF8Decode(FileName);
Result:= CreateFileW(PWChar(wFileName), GENERIC_READ or GENERIC_WRITE,
FILE_SHARE_READ, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0);
end;
{$ELSE}
begin
Result:= fpOpen(FileName, O_Creat or O_RdWr or O_Trunc);
end;
{$ENDIF}
{ TFileStreamEx }
constructor TFileStreamEx.Create(const AFileName: UTF8String; Mode: Word);
var
H: System.THandle;
begin
{$IF (FPC_VERSION > 2) or ((FPC_VERSION=2) and (FPC_RELEASE >= 5))}
if (Mode and fmCreate) <> 0 then
{$ELSE}
if Mode = fmCreate then
{$ENDIF}
begin
H:= mbFileCreate(AFileName);
if H = feInvalidHandle then
raise EFCreateError.CreateFmt(SFCreateError, [AFileName])
else
inherited Create(H);
end
else
begin
H:= mbFileOpen(AFileName, Mode);
if H = feInvalidHandle then
raise EFOpenError.CreateFmt(SFOpenError, [AFilename])
else
inherited Create(H);
end;
FFileName:= AFileName;
end;
destructor TFileStreamEx.Destroy;
begin
inherited Destroy;
// Close handle after destroying the base object, because it may use Handle in Destroy.
if Handle >= 0 then
FileClose(Handle);
end;
function mbFileExists(const FileName: UTF8String) : Boolean;
{$IFDEF MSWINDOWS}
var
Attr: Dword;
wFileName: WideString;
begin
Result:=False;
wFileName:= UTF8Decode(FileName);
Attr:= GetFileAttributesW(PWChar(wFileName));
if Attr <> DWORD(-1) then
Result:= (Attr and FILE_ATTRIBUTE_DIRECTORY) = 0;
end;
{$ELSE}
var
Info: BaseUnix.Stat;
begin
Result:= False;
// Can use fpStat, because link to an existing filename can be opened as if it were a real file.
if fpStat(FileName, Info) >= 0 then
Result:= fpS_ISREG(Info.st_mode);
end;
{$ENDIF}
function mbDeleteFile(const FileName: UTF8String): Boolean;
{$IFDEF MSWINDOWS}
var
wFileName: WideString;
begin
wFileName:= UTF8Decode(FileName);
Result:= Windows.DeleteFileW(PWChar(wFileName));
end;
{$ELSE}
begin
Result:= fpUnLink(FileName) = 0;
end;
{$ENDIF}
function mbFileGetAttr(const FileName: UTF8String): Cardinal;
{$IFDEF MSWINDOWS}
var
wFileName: WideString;
begin
wFileName:= UTF8Decode(FileName);
Result := GetFileAttributesW(PWChar(wFileName));
end;
{$ELSE}
var
Info: BaseUnix.Stat;
begin
Result:= faInvalidAttributes;
if fpLStat(FileName, @Info) >= 0 then
Result:= Info.st_mode;
end;
{$ENDIF}
function mbCreateDir(const NewDir: UTF8String): Boolean;
{$IFDEF MSWINDOWS}
var
wNewDir: WideString;
begin
wNewDir:= UTF8Decode(NewDir);
Result:= CreateDirectoryW(PWChar(wNewDir), nil);
end;
{$ELSE}
begin
Result:= fpMkDir(PChar(NewDir), $1FF) = 0; // $1FF = &0777
end;
{$ENDIF}
function mbFileSetAttr(const FileName: UTF8String; Attr: Cardinal): LongInt;
{$IFDEF MSWINDOWS}
var
wFileName: WideString;
begin
Result:= 0;
wFileName:= UTF8Decode(FileName);
if not SetFileAttributesW(PWChar(wFileName), Attr) then
Result:= GetLastError;
end;
{$ELSE}
begin
Result:= fpchmod(PChar(FileName), Attr);
end;
{$ENDIF}
function mbFileSize(const FileName: UTF8String): Int64;
{$IFDEF MSWINDOWS}
var
Handle: System.THandle;
FindData: TWin32FindDataW;
wFileName: WideString;
begin
Result:= 0;
wFileName:= UTF8Decode(FileName);
Handle := FindFirstFileW(PWChar(wFileName), FindData);
if Handle <> INVALID_HANDLE_VALUE then
begin
Windows.FindClose(Handle);
if (FindData.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY) = 0 then
Result:= (Int64(FindData.nFileSizeHigh) * MAXDWORD)+FindData.nFileSizeLow;
end;
end;
{$ELSE}
var
Info: BaseUnix.Stat;
begin
Result:= 0;
if fpStat(FileName, Info) >= 0 then
Result:= Info.st_size;
end;
{$ENDIF}
function mbRenameFile(const OldName: UTF8String; NewName: UTF8String): Boolean;
{$IFDEF MSWINDOWS}
var
wOldName,
wNewName: WideString;
begin
wOldName:= UTF8Decode(OldName);
wNewName:= UTF8Decode(NewName);
Result:= MoveFileExW(PWChar(wOldName), PWChar(wNewName), MOVEFILE_REPLACE_EXISTING);
end;
{$ELSE}
var
tmpFileName: UTF8String;
OldFileStat, NewFileStat: stat;
begin
if GetPathType(NewName) <> ptAbsolute then
NewName := ExtractFilePath(OldName) + NewName;
if OldName = NewName then
Exit(True);
if fpLstat(UTF8ToSys(OldName), OldFileStat) <> 0 then
Exit(False);
// Check if target file exists.
if fpLstat(UTF8ToSys(NewName), NewFileStat) = 0 then
begin
// Check if source and target are the same files (same inode and same device).
if (OldFileStat.st_ino = NewFileStat.st_ino) and
(OldFileStat.st_dev = NewFileStat.st_dev) then
begin
// Check number of links.
// If it is 1 then source and target names most probably differ only
// by case on a case-insensitive filesystem. Direct rename() in such case
// fails on Linux, so we use a temporary file name and rename in two stages.
// If number of links is more than 1 then it's enough to simply unlink
// the source file, since both files are technically identical.
// (On Linux rename() returns success but doesn't do anything
// if renaming a file to its hard link.)
// We cannot use st_nlink for directories because it means "number of
// subdirectories"; hard links to directories are not supported on Linux
// or Windows anyway (on MacOSX they are). Therefore we always treat
// directories as if they were a single link and rename them using temporary name.
if (NewFileStat.st_nlink = 1) or BaseUnix.fpS_ISDIR(NewFileStat.st_mode) then
begin
tmpFileName := GetTempName(OldName);
if FpRename(UTF8ToSys(OldName), UTF8ToSys(tmpFileName)) = 0 then
begin
if fpLstat(UTF8ToSys(NewName), NewFileStat) = 0 then
begin
// We have renamed the old file but the new file name still exists,
// so this wasn't a single file on a case-insensitive filesystem
// accessible by two names that differ by case.
FpRename(UTF8ToSys(tmpFileName), UTF8ToSys(OldName)); // Restore old file.
{$IFDEF DARWIN}
// If it's a directory with multiple hard links then simply unlink the source.
if BaseUnix.fpS_ISDIR(NewFileStat.st_mode) and (NewFileStat.st_nlink > 1) then
Result := (fpUnLink(UTF8ToSys(OldName)) = 0)
else
{$ENDIF}
Result := False;
end
else if FpRename(UTF8ToSys(tmpFileName), UTF8ToSys(NewName)) = 0 then
begin
Result := True;
end
else
begin
FpRename(UTF8ToSys(tmpFileName), UTF8ToSys(OldName)); // Restore old file.
Result := False;
end;
end
else
Result := False;
end
else
begin
// Multiple links - simply unlink the source file.
Result := (fpUnLink(UTF8ToSys(OldName)) = 0);
end;
Exit;
end;
end;
Result := FpRename(UTF8ToSys(OldName), UTF8ToSys(NewName)) = 0;
end;
{$ENDIF}
function mbFileSystemEntryExists(const Path: UTF8String): Boolean;
begin
Result := mbFileGetAttr(Path) <> faInvalidAttributes;
end;
function GetTempName(PathPrefix: String): String;
const
MaxTries = 100;
var
TryNumber: Integer = 0;
begin
if PathPrefix = '' then
PathPrefix := GetTempDir;
repeat
Result := PathPrefix + IntToStr(System.Random(MaxInt)); // or use CreateGUID()
Inc(TryNumber);
if TryNumber = MaxTries then
Exit('');
until not mbFileSystemEntryExists(Result);
end;
end.

View file

@ -52,15 +52,23 @@
</Item4>
</Files>
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="2">
<RequiredPkgs Count="4">
<Item1>
<PackageName Value="LCL"/>
<MinVersion Major="1" Valid="True"/>
<PackageName Value="doublecmd_common"/>
<MinVersion Minor="1" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="doublecmd_common_lcl"/>
<MinVersion Minor="1" Valid="True"/>
</Item2>
<Item3>
<PackageName Value="LCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
<Item4>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item2>
</Item4>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>

View file

@ -33,7 +33,7 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, ComCtrls,
Graphics, Dialogs, ExtCtrls, Buttons, FileUtil, Menus,
KASXmlConfig, KASToolItems;
DCXmlConfig, KASToolItems;
type
@ -187,7 +187,7 @@ procedure Register;
implementation
uses
Themes, types, math, KASClassesEx;
Themes, types, math, DCOSUtils;
type
PToolItemExecutor = ^TToolItemExecutor;

View file

@ -27,7 +27,7 @@ unit KASToolItems;
interface
uses
Classes, SysUtils, KASXmlConfig;
Classes, SysUtils, DCXmlConfig;
type
TDynamicStringArray = array of String;

View file

@ -10,6 +10,8 @@ pushd components
lazbuild chsdet\chsdet.lpk %DC_ARCH%
lazbuild CmdLine\cmdbox.lpk %DC_ARCH%
lazbuild dcpcrypt\dcpcrypt.lpk %DC_ARCH%
lazbuild doublecmd\doublecmd_common.lpk %DC_ARCH%
lazbuild doublecmd\doublecmd_common_lcl.lpk %DC_ARCH%
lazbuild KASToolBar\kascomp.lpk %DC_ARCH%
lazbuild viewer\viewerpackage.lpk %DC_ARCH%
lazbuild gifanim\pkg_gifanim.lpk %DC_ARCH%

View file

@ -9,6 +9,8 @@ cd components
$lazbuild chsdet/chsdet.lpk $DC_ARCH
$lazbuild CmdLine/cmdbox.lpk $DC_ARCH
$lazbuild dcpcrypt/dcpcrypt.lpk $DC_ARCH
$lazbuild doublecmd/doublecmd_common.lpk $%DC_ARCH
$lazbuild doublecmd/doublecmd_common_lcl.lpk $DC_ARCH
$lazbuild KASToolBar/kascomp.lpk $DC_ARCH
$lazbuild viewer/viewerpackage.lpk $DC_ARCH
$lazbuild gifanim/pkg_gifanim.lpk $DC_ARCH

View file

@ -0,0 +1,56 @@
{
Double commander
-------------------------------------------------------------------------
Definitions of basic types.
Copyright (C) 2012 Przemyslaw Nagay (cobines@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit DCBasicTypes;
interface
type
TLibHandle = PtrInt;
TDynamicStringArray = array of String;
TCharSet = set of Char;
TFileAttrs = Cardinal; // file attributes type regardless of system
TWinFileTime = QWord; // NTFS time (UTC) (2 x DWORD)
TDosFileTime = LongInt; // MS-DOS time (local)
{$IFDEF MSWINDOWS}
TFileTime = TWinFileTime;
{$ELSE}
// Unix time (UTC).
// Unix defines time_t as signed integer,
// but we define it as unsigned because sign is not needed.
{$IFDEF cpu64}
TFileTime = QWord;
{$ELSE}
TFileTime = DWord;
{$ENDIF}
{$ENDIF}
PFileTime = ^TFileTime;
PWinFileTime = ^TWinFileTime;
implementation
end.

View file

@ -0,0 +1,226 @@
{
Double commander
-------------------------------------------------------------------------
This module contains classes with UTF8 file names support.
Copyright (C) 2008-2011 Koblov Alexander (Alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit DCClassesUtf8;
{$mode objfpc}{$H+}
interface
uses
Classes, RtlConsts, SysUtils, IniFiles;
{$IF (FPC_VERSION = 2) and (FPC_RELEASE < 5)}
const
{ TFileStream create mode }
fmCreate = $FF00;
{$ENDIF}
type
{ TFileStreamEx class }
TFileStreamEx = class(THandleStream)
private
FHandle: THandle;
FFileName: UTF8String;
public
constructor Create(const AFileName: UTF8String; Mode: Word);
destructor Destroy; override;
{$IF (FPC_VERSION <= 2) and (FPC_RELEASE <= 4) and (FPC_PATCH <= 0)}
function ReadQWord: QWord;
procedure WriteQWord(q: QWord);
{$ENDIF}
property FileName: UTF8String read FFileName;
end;
{ TStringListEx }
TStringListEx = class(TStringList)
public
function IndexOfValue(const Value: String): Integer;
procedure LoadFromFile(const FileName: String); override;
procedure SaveToFile(const FileName: String); override;
end;
{ TIniFileEx }
THackIniFile = class
private
FFileName: UTF8String;
end;
TIniFileEx = class(TIniFile)
private
FIniFileStream: TFileStreamEx;
function GetFileName: UTF8String;
procedure SetFileName(const AValue: UTF8String);
public
constructor Create(const AFileName: String; Mode: Word); virtual;
constructor Create(const AFileName: string; AEscapeLineFeeds : Boolean = False); override;
destructor Destroy; override;
procedure UpdateFile; override;
property FileName: UTF8String read GetFileName write SetFileName;
end;
implementation
uses
DCOSUtils;
{ TFileStreamEx }
constructor TFileStreamEx.Create(const AFileName: UTF8String; Mode: Word);
begin
if (Mode and fmCreate) <> 0 then
begin
FHandle:= mbFileCreate(AFileName, Mode);
if FHandle = feInvalidHandle then
raise EFCreateError.CreateFmt(SFCreateError, [AFileName])
else
inherited Create(FHandle);
end
else
begin
FHandle:= mbFileOpen(AFileName, Mode);
if FHandle = feInvalidHandle then
raise EFOpenError.CreateFmt(SFOpenError, [AFilename])
else
inherited Create(FHandle);
end;
FFileName:= AFileName;
end;
destructor TFileStreamEx.Destroy;
begin
inherited Destroy;
// Close handle after destroying the base object, because it may use Handle in Destroy.
if FHandle >= 0 then FileClose(FHandle);
end;
{$IF (FPC_VERSION <= 2) and (FPC_RELEASE <= 4) and (FPC_PATCH <= 0)}
function TFileStreamEx.ReadQWord: QWord;
var
q: QWord;
begin
ReadBuffer(q, SizeOf(QWord));
ReadQWord:= q;
end;
procedure TFileStreamEx.WriteQWord(q: QWord);
begin
WriteBuffer(q, SizeOf(QWord));
end;
{$ENDIF}
{ TStringListEx }
function TStringListEx.IndexOfValue(const Value: String): Integer;
var
iStart: LongInt;
sTemp: String;
begin
CheckSpecialChars;
Result:= 0;
while (Result < Count) do
begin
sTemp:= Strings[Result];
iStart:= Pos(NameValueSeparator, sTemp) + 1;
if (iStart > 0) and (DoCompareText(Value, Copy(sTemp, iStart, MaxInt)) = 0) then
Exit;
Inc(result);
end;
Result:= -1;
end;
procedure TStringListEx.LoadFromFile(const FileName: String);
var
fsFileStream: TFileStreamEx;
begin
fsFileStream:= TFileStreamEx.Create(FileName, fmOpenRead or fmShareDenyNone);
LoadFromStream(fsFileStream);
fsFileStream.Free;
end;
procedure TStringListEx.SaveToFile(const FileName: String);
var
fsFileStream: TFileStreamEx;
begin
if mbFileExists(FileName) then
begin
fsFileStream:= TFileStreamEx.Create(FileName, fmOpenWrite or fmShareDenyNone);
fsFileStream.Position:= 0;
fsFileStream.Size:= 0;
end
else
fsFileStream:= TFileStreamEx.Create(FileName, fmCreate);
SaveToStream(fsFileStream);
fsFileStream.Free;
end;
{ TIniFileEx }
function TIniFileEx.GetFileName: UTF8String;
begin
Result:= THackIniFile(Self).FFileName;
end;
procedure TIniFileEx.SetFileName(const AValue: UTF8String);
begin
THackIniFile(Self).FFileName:= AValue;
end;
constructor TIniFileEx.Create(const AFileName: String; Mode: Word);
begin
if mbFileExists(AFileName) then
FIniFileStream:= TFileStreamEx.Create(AFileName, Mode or fmShareDenyNone)
else
FIniFileStream:= TFileStreamEx.Create(AFileName, fmCreate);
inherited Create(FIniFileStream);
FileName:= AFileName;
end;
constructor TIniFileEx.Create(const AFileName: string; AEscapeLineFeeds: Boolean);
begin
{$PUSH}{$HINTS OFF}
Create(AFileName, fmOpenReadWrite);
{$POP}
end;
procedure TIniFileEx.UpdateFile;
begin
Stream.Position:=0;
Stream.Size:= 0;
FileName:= EmptyStr;
inherited UpdateFile;
FileName:= FIniFileStream.FileName;
end;
destructor TIniFileEx.Destroy;
begin
inherited Destroy;
// Destroy stream after destroying the base object, because it may use the stream in Destroy.
FreeAndNil(FIniFileStream);
end;
end.

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,923 @@
{
Double Commander
-------------------------------------------------------------------------
Useful functions dealing with strings.
Copyright (C) 2006-2011 Koblov Alexander (Alexx2000@mail.ru)
Copyright (C) 2012 Przemyslaw Nagay (cobines@gmail.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit DCStrUtils;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, DCBasicTypes;
type
TPathType = (ptNone, ptRelative, ptAbsolute);
{en
Checks if StringToCheck contains any of the single characters in
PossibleCharacters. Only ASCII can be searched.
}
function ContainsOneOf(StringToCheck: UTF8String; PossibleCharacters: String): Boolean;
{en
Convert known directory separators to the current directory separator.
}
function NormalizePathDelimiters(const Path: String): String;
{en
Get last directory name in path
@returns(Last directory name in path)
}
function GetLastDir(Path : String) : String;
{en
Retrieves the root directory for a path.
@param(sPath Absolute path to a directory or a file.)
@returns(Root directory or an empty string if the path is not absolute.)
}
function GetRootDir(sPath : String) : String;
{en
Retrieves parent directory for a path (removes the last subdirectory in the path).
@param(sPath Absolute or relative path to a directory or a file.)
@returns(Parent directory or an empty string
if the path does not have a parent directory.)
}
function GetParentDir(sPath : String) : String;
{en
Gets the deepest (longest) path that exist.
}
function GetDeepestExistingPath(const sPath : UTF8String) : UTF8String;
function GetSplitFileName(var sFileName, sPath : String) : String;
function MakeFileName(const sPath, sFileNameDef : String) : String;
{en
Split path into list of directories
@param(DirName Path)
@param(Dirs List of directories names)
@returns(The function returns the number of directories found, or -1
if none were found.)
}
function GetDirs (DirName : String; var Dirs : TStringList) : Longint;
{en
Get absolute file name from relative file name
@param(sPath Current path)
@param(sRelativeFileName Relative file name)
@returns(Absolute file name)
}
function GetAbsoluteFileName(const sPath, sRelativeFileName : String) : String;
{en
Checks if a path to a directory or file is absolute or relative.
@returns(ptNone if a path is just a directory or file name (MyDir)
ptRelative if a path is relative (MyDir/MySubDir)
ptAbsolute if a path is absolute) (/root/MyDir)
}
function GetPathType(const sPath : String): TPathType;
{en
Get file name without path and extension
@param(FileName File name)
@returns(File name without path and extension)
}
function ExtractOnlyFileName(const FileName: string): string;
{en
Get file extension without the '.' at the front.
}
function ExtractOnlyFileExt(const FileName: string): string;
{en
Remove file extension with the '.' from file name.
}
function RemoveFileExt(const FileName: UTF8String): UTF8String;
function ContainsWildcards(const Path: UTF8String): Boolean;
{en
Expands an absolute file path by removing all relative references.
Processes '/../' and '/./'.
Example: /home/user/files/../somedirectory/./file.txt
= /home/user/somedirectory/file.txt
@param(Path path to expand.)
}
function ExpandAbsolutePath(const Path: String): String;
function HasPathInvalidCharacters(Path: UTF8String): Boolean;
{en
Checks if a file or directory belongs in the specified path.
Only strings are compared, no file-system checks are done.
@param(sBasePath
Absolute path where the path to check should be in.)
@param(sPathToCheck
Absolute path to file or directory to check.)
@param(AllowSubDirs
If @true, allows the sPathToCheck to point to a file or directory in some subdirectory of sBasePath.
If @false, only allows the sPathToCheck to point directly to a file or directory in sBasePath.)
@param(AllowSame
If @true, returns @true if sBasePath = sPathToCheck.
If @false, returns @false if sBasePath = sPathToCheck.)
@return(@true if sPathToCheck points to a directory or file in sBasePath.
@false otherwise.)
Examples:
IsInPath('/home', '/home/somedir/somefile', True, False) = True
IsInPath('/home', '/home/somedir/somefile', False, False) = False
IsInPath('/home', '/home/somedir/', False, False) = True
IsInPath('/home', '/home', False, False) = False
IsInPath('/home', '/home', False, True) = True
}
function IsInPath(sBasePath : String; sPathToCheck : String;
AllowSubDirs : Boolean; AllowSame : Boolean) : Boolean;
{en
Changes a path to be relative to some parent directory.
@param(sPrefix
Absolute path that is a parent of sPath.)
@param(sPath
Path to change. Must be a subpath of sPrefix, otherwise no change is made.)
Examples:
ExtractDirLevel('/home', '/home/somedir/somefile') = '/somedir/somefile'
}
function ExtractDirLevel(const sPrefix, sPath: String): String;
{en
Adds a path delimiter at the beginning of the string, if it not exists.
}
function IncludeFrontPathDelimiter(s: String): String;
{en
Removes a path delimiter at the beginning of the string, if it exists.
}
function ExcludeFrontPathDelimiter(s: String): String;
{en
Removes a path delimiter at the ending of the string, if it exists.
Doesn't remove path delimiter if it is the only character in the path (root dir),
so it is safer to use than ExcludeTrailingPathDelimiter, especially on Unix.
}
function ExcludeBackPathDelimiter(const Path: UTF8String): UTF8String;
{en
Return position of character in string begun from start position
@param(C character)
@param(S String)
@param(StartPos Start position)
@returns(Position of character in string)
}
function CharPos(C: Char; const S: string; StartPos: Integer = 1): Integer;
{en
Split file name on name and extension
@param(sFileName File name)
@param(n Name)
@param(e Extension)
}
procedure DivFileName(const sFileName:String; out n,e:String);
{en
Get count of character in string
@param(Char Character)
@param(S String)
@returns(Count of character)
}
function NumCountChars(const Char: Char; const S: String): Integer;
{en
Remove last line ending in text
@param(sText Text)
@param(TextLineBreakStyle Text line break style)
}
function TrimRightLineEnding(const sText: UTF8String; TextLineBreakStyle: TTextLineBreakStyle): UTF8String;
function mbCompareText(const s1, s2: UTF8String): PtrInt;
function StrNewW(const mbString: UTF8String): PWideChar;
procedure StrDisposeW(var pStr : PWideChar);
function StrLCopyW(Dest, Source: PWideChar; MaxLen: SizeInt): PWideChar;
function StrPCopyW(Dest: PWideChar; const Source: WideString): PWideChar;
function StrPLCopyW(Dest: PWideChar; const Source: WideString; MaxLen: Cardinal): PWideChar;
{en
Checks if a string begins with another string.
@returns(@true if StringToCheck begins with StringToMatch.
StringToCheck may be longer than StringToMatch.)
}
function StrBegins(const StringToCheck, StringToMatch: String): Boolean;
{en
Checks if a string ends with another string.
@returns(@true if StringToCheck ends with StringToMatch.
StringToCheck may be longer than StringToMatch.)
}
function StrEnds(const StringToCheck, StringToMatch: String): Boolean;
{en
Adds a string to another string. If the source string is not empty adds
a separator before adding the string.
}
procedure AddStrWithSep(var SourceString: String; const StringToAdd: String; const Separator: Char = ' ');
procedure ParseLineToList(sLine: String; ssItems: TStrings);
{en
Convert a number specified as an octal number to it's decimal value.
@param(Value Octal number as string)
@returns(Decimal number)
}
function OctToDec(Value: String): LongInt;
{en
Convert a number specified as an decimal number to it's octal value.
@param(Value Decimal number)
@returns(Octal number as string)
}
function DecToOct(Value: LongInt): String;
procedure AddString(var anArray: TDynamicStringArray; const sToAdd: String);
{en
Checks if the second array is the beginning of first.
If BothWays is @true then also checks the other way around,
if the first array is the beginning of second.
For Array1=[1,2] Array2=[1,2] returns @true.
For Array1=[1,2,...] Array2=[1,2] returns @true.
For Array1=[1,3,...] Array2=[1,2] returns @false.
If BothWays = True then also
For Array1=[1] Array2=[1,2] returns @true.
For Array1=[1] Array2=[2] returns @false.
}
function ArrBegins(const Array1, Array2: array of String; BothWays: Boolean): Boolean;
function ArrayToString(const anArray: TDynamicStringArray; const Separator: Char = ' '): String;
{en
Compares length and contents of the arrays.
If lengths differ or individual elements differ returns @false, otherwise @true.
}
function Compare(const Array1, Array2: array of String): Boolean;
{en
Copies open array to dynamic array.
}
function CopyArray(const anArray: array of String): TDynamicStringArray;
function ContainsOneOf(const ArrayToSearch, StringsToSearch: array of String): Boolean;
function Contains(const ArrayToSearch: array of String; const StringToSearch: String): Boolean;
procedure DeleteString(var anArray: TDynamicStringArray; const Index: Integer);
procedure DeleteString(var anArray: TDynamicStringArray; const sToDelete: String);
{en
Replaces old value of Key or adds a new Key=NewValue string to the array.
}
procedure SetValue(var anArray: TDynamicStringArray; Key, NewValue: String);
procedure SetValue(var anArray: TDynamicStringArray; Key: String; NewValue: Boolean);
function ShortcutsToText(const Shortcuts: TDynamicStringArray): String;
implementation
uses
DCOSUtils;
function NormalizePathDelimiters(const Path: String): String;
{$IFDEF UNIX}
begin
Result:= Path;
end;
{$ELSE}
const
AllowPathDelimiters : set of char = ['\','/'];
var
I : LongInt;
begin
Result:= Path;
for I:= 1 to Length(Path) do
if Path[I] in AllowPathDelimiters then
Result[I]:= DirectorySeparator;
end;
{$ENDIF}
function GetLastDir(Path : String) : String;
begin
Result:= ExtractFileName(ExcludeTrailingPathDelimiter(Path));
if Result = '' then
Result:= ExtractFileDrive(Path);
if Result = '' then
Result:= PathDelim;
end;
function GetRootDir(sPath : String) : String;
begin
{$IF DEFINED(MSWINDOWS)}
Result := ExtractFileDrive(sPath);
if Result <> '' then
Result := Result + PathDelim;
{$ELSEIF DEFINED(UNIX)}
Result := PathDelim; // Hardcoded
{$ELSE}
Result := '';
{$ENDIF}
end;
function GetParentDir(sPath : String) : String;
var
i : Integer;
begin
Result := '';
sPath := ExcludeTrailingPathDelimiter(sPath);
// Start from one character before last.
for i := length(sPath) - 1 downto 1 do
if sPath[i] = DirectorySeparator then
begin
Result := Copy(sPath, 1, i);
Break;
end;
end;
function GetDeepestExistingPath(const sPath : UTF8String) : UTF8String;
begin
Result := sPath;
while Result <> EmptyStr do
begin
if not mbDirectoryExists(Result) then
Result := GetParentDir(Result)
else
Break;
end;
end;
function GetSplitFileName(var sFileName, sPath : String) : String;
begin
if Pos(PathDelim, sFileName) <> 0 then
begin
Result := sFileName;
sPath := ExtractFilePath(sFileName);
sFileName := ExtractFileName(sFileName);
end
else
Result := sPath + sFileName;
end;
function MakeFileName(const sPath, sFileNameDef : String) : String;
begin
Result:= ExtractFileName(ExcludeTrailingBackslash(sPath));
if Result = EmptyStr then
Result:= sFileNameDef;
end;
function GetDirs (DirName : String; var Dirs : TStringList) : Longint;
var
I : Longint;
len : Integer;
sDir : String;
begin
I:= 1;
Result:= -1;
len := Length(DirName);
while I <= len do
begin
if DirName[I]=PathDelim then
begin
Inc(Result);
sDir := Copy(DirName, 1, len - (len - I + 1));
if dirs.IndexOf(sDir) < 0 then
dirs.Add(sDir);
end;
Inc(I);
end;
if Result > -1 then inc(Result);
end;
function GetAbsoluteFileName(const sPath, sRelativeFileName : String) : String;
begin
case GetPathType(sRelativeFileName) of
ptNone:
Result := sPath + sRelativeFileName;
ptRelative:
Result := ExpandAbsolutePath(sPath + sRelativeFileName);
ptAbsolute:
Result := sRelativeFileName;
end;
end;
function GetPathType(const sPath : String): TPathType;
begin
if sPath <> EmptyStr then
begin
{$IFDEF MSWINDOWS}
{check for drive/unc info}
if ( Pos( '\\', sPath ) > 0 ) or ( Pos( DriveDelim, sPath ) > 0 ) then
{$ENDIF MSWINDOWS}
{$IFDEF UNIX}
{ UNIX absolute paths start with a slash }
if (sPath[1] = PathDelim) then
{$ENDIF UNIX}
Result := ptAbsolute
else if ( Pos( PathDelim, sPath ) > 0 ) then
Result := ptRelative
else
Result := ptNone;
end
else
Result := ptNone;
end;
function ExtractOnlyFileName(const FileName: string): string;
var
iDotIndex,
I: longint;
begin
(* Find a dot index *)
I := Length(FileName);
while (I > 0) and not (FileName[I] in ['.', '/', '\', ':']) do Dec(I);
if (I > 0) and (FileName[I] = '.') then
iDotIndex := I
else
iDotIndex := MaxInt;
(* Find file name index *)
I := Length(FileName);
while (I > 0) and not (FileName[I] in ['/', '\', ':']) do Dec(I);
Result := Copy(FileName, I + 1, iDotIndex - I - 1);
end;
function ExtractOnlyFileExt(const FileName: string): string;
var
I : LongInt;
EndSep : Set of Char;
begin
I := Length(FileName);
EndSep:= AllowDirectorySeparators + AllowDriveSeparators + [ExtensionSeparator];
while (I > 0) and not (FileName[I] in EndSep) do
Dec(I);
if (I > 0) and (FileName[I] = ExtensionSeparator) then
Result := Copy(FileName, I + 1, MaxInt)
else
Result := '';
end;
function RemoveFileExt(const FileName: UTF8String): UTF8String;
var
I : LongInt;
EndSep : Set of Char;
begin
I := Length(FileName);
EndSep:= AllowDirectorySeparators + AllowDriveSeparators + [ExtensionSeparator];
while (I > 0) and not (FileName[I] in EndSep) do
Dec(I);
if (I > 0) and (FileName[I] = ExtensionSeparator) then
Result := Copy(FileName, 1, I - 1)
else
Result := FileName;
end;
function ContainsWildcards(const Path: UTF8String): Boolean;
begin
Result := ContainsOneOf(Path, '*?');
end;
function ExpandAbsolutePath(const Path: String): String;
var
I, J: Integer;
begin
Result := Path;
{First remove all references to '\.\'}
I := Pos (DirectorySeparator + '.' + DirectorySeparator, Result);
while I <> 0 do
begin
Delete (Result, I, 2);
I := Pos (DirectorySeparator + '.' + DirectorySeparator, Result);
end;
if StrEnds(Result, DirectorySeparator + '.') then
Delete (Result, Length(Result) - 1, 2);
{Then remove all references to '\..\'}
I := Pos (DirectorySeparator + '..', Result);
while (I <> 0) do
begin
J := Pred (I);
while (J > 0) and (Result [J] <> DirectorySeparator) do
Dec (J);
if (J = 0) then
Delete (Result, I, 3)
else
Delete (Result, J, I - J + 3);
I := Pos (DirectorySeparator + '..', Result);
end;
end;
function HasPathInvalidCharacters(Path: UTF8String): Boolean;
begin
Result := ContainsOneOf(Path, '*?');
end;
function IsInPath(sBasePath : String; sPathToCheck : String;
AllowSubDirs : Boolean; AllowSame : Boolean) : Boolean;
var
BasePathLength, PathToCheckLength: Integer;
DelimiterPos: Integer;
begin
if sBasePath = '' then Exit(False);
sBasePath := IncludeTrailingPathDelimiter(sBasePath);
BasePathLength := Length(sBasePath);
PathToCheckLength := Length(sPathToCheck);
if PathToCheckLength > BasePathLength then
begin
if CompareStr(Copy(sPathToCheck, 1, BasePathLength), sBasePath) = 0 then
begin
if AllowSubDirs then
Result := True
else
begin
// Additionally check if the remaining path is a relative path.
// Look for a path delimiter in the middle of the filepath.
sPathToCheck := Copy(sPathToCheck, 1 + BasePathLength,
PathToCheckLength - BasePathLength);
DelimiterPos := Pos(DirectorySeparator, sPathToCheck);
// If no delimiter was found or it was found at then end (directories
// may end with it), then the 'sPathToCheck' is in 'sBasePath'.
Result := (DelimiterPos = 0) or (DelimiterPos = PathToCheckLength - BasePathLength);
end;
end
else
Result := False;
end
else
Result := AllowSame and
(((PathToCheckLength = BasePathLength) and
(CompareStr(sPathToCheck, sBasePath) = 0)) or
((PathToCheckLength = BasePathLength - 1) and
(CompareStr(Copy(sBasePath, 1, PathToCheckLength), sPathToCheck) = 0)));
end;
function ExtractDirLevel(const sPrefix, sPath: String): String;
var
PrefixLength: Integer;
begin
if IsInPath(sPrefix, sPath, True, True) then
begin
PrefixLength := Length(sPrefix);
Result := Copy(sPath, 1 + PrefixLength, Length(sPath) - PrefixLength)
end
else
Result := sPath;
end;
function IncludeFrontPathDelimiter(s: String): String;
begin
if (Length(s) > 0) and (s[1] = PathDelim) then
Result:= s
else
Result:= PathDelim + s;
end;
function ExcludeFrontPathDelimiter(s: String): String;
begin
if (Length(s) > 0) and (s[1] = PathDelim) then
Result := Copy(s, 2, Length(s) - 1)
else
Result := s;
end;
function ExcludeBackPathDelimiter(const Path: UTF8String): UTF8String;
var
L: Integer;
begin
L:= Length(Path);
if (L > 1) and (Path[L] in AllowDirectorySeparators) then
Result:= Copy(Path, 1, L - 1)
else
Result:= Path;
end;
procedure DivFileName(const sFileName:String; out n,e:String);
var
i:Integer;
begin
for i:= length(sFileName) downto 1 do
if sFileName[i]='.' then
begin
// if i>1 then // hidden files??
e:=Copy(sFileName,i,Length(sFileName)-i+1);
n:=Copy(sFileName,1,i-1);
Exit;
end;
e:='';
n:=sFileName;
end;
function CharPos(C: Char; const S: string; StartPos: Integer = 1): Integer;
var
sNewStr : String;
begin
if StartPos <> 1 then
begin
sNewStr := Copy(S, StartPos, Length(S) - StartPos + 1);
Result := Pos(C, sNewStr);
if Result <> 0 then
Result := Result + StartPos - 1;
end
else
Result := Pos(C, S);
end;
function NumCountChars(const Char: char; const S: String): Integer;
var
I : Integer;
begin
Result := 0;
if Length(S) > 0 then
for I := 1 to Length(S) do
if S[I] = Char then Inc(Result);
end;
function TrimRightLineEnding(const sText: UTF8String; TextLineBreakStyle: TTextLineBreakStyle): UTF8String;
const
TextLineBreakArray: array[TTextLineBreakStyle] of Integer = (1, 2, 1);
var
I, L: Integer;
begin
L:= Length(sText);
I:= TextLineBreakArray[TextLineBreakStyle];
Result:= Copy(sText, 1, L - I); // Copy without last line ending
end;
function mbCompareText(const s1, s2: UTF8String): PtrInt; inline;
begin
// From 0.9.31 LazUtils can be used but this package does not exist in 0.9.30.
// Result := LazUTF8.UTF8CompareText(s1, s2);
Result := WideCompareText(UTF8Decode(s1), UTF8Decode(s2));
end;
function StrNewW(const mbString: UTF8String): PWideChar;
var
wsString: WideString;
iLength: PtrInt;
begin
Result:= nil;
wsString:= UTF8Decode(mbString);
iLength:= (Length(wsString) * SizeOf(WideChar)) + 1;
Result:= GetMem(iLength);
if Result <> nil then
Move(PWideChar(wsString)^, Result^, iLength);
end;
procedure StrDisposeW(var pStr : PWideChar);
begin
FreeMem(pStr);
pStr := nil;
end;
function StrLCopyW(Dest, Source: PWideChar; MaxLen: SizeInt): PWideChar;
var
I: SizeInt;
begin
Result := Dest;
for I:= 0 to MaxLen - 1 do
begin
if Source^ = #0 then Break;
Dest^ := Source^;
Inc(Source);
Inc(Dest);
end;
Dest^ := #0;
end;
function StrPCopyW(Dest: PWideChar; const Source: WideString): PWideChar;
begin
Result := StrLCopyW(Dest, PWideChar(Source), Length(Source));
end;
function StrPLCopyW(Dest: PWideChar; const Source: WideString; MaxLen: Cardinal): PWideChar;
begin
Result := StrLCopyW(Dest, PWideChar(Source), MaxLen);
end;
function StrBegins(const StringToCheck, StringToMatch: String): Boolean;
begin
Result := (Length(StringToCheck) >= Length(StringToMatch)) and
(CompareChar(StringToCheck[1], StringToMatch[1], Length(StringToMatch)) = 0);
end;
function StrEnds(const StringToCheck, StringToMatch: String): Boolean;
begin
Result := (Length(StringToCheck) >= Length(StringToMatch)) and
(CompareChar(StringToCheck[1 + Length(StringToCheck) - Length(StringToMatch)],
StringToMatch[1], Length(StringToMatch)) = 0);
end;
procedure AddStrWithSep(var SourceString: String; const StringToAdd: String; const Separator: Char);
begin
if Length(SourceString) > 0 then
SourceString := SourceString + Separator;
SourceString := SourceString + StringToAdd;
end;
procedure ParseLineToList(sLine: String; ssItems: TStrings);
var
xPos: Integer;
begin
ssItems.Clear;
while sLine <> '' do
begin
xPos:= Pos(';', sLine);
if xPos > 0 then
begin
ssItems.Add(Copy(sLine, 1, xPos - 1));
Delete(sLine, 1, xPos);
end
else
begin
ssItems.Add(sLine);
Exit;
end;
end;
end;
function ContainsOneOf(StringToCheck: UTF8String; PossibleCharacters: String): Boolean;
var
i, j: SizeInt;
pc : PChar;
begin
pc := @StringToCheck[1];
for i := 1 to Length(StringToCheck) do
begin
for j := 1 to Length(PossibleCharacters) do
if pc^ = PossibleCharacters[j] then
Exit(True);
Inc(pc);
end;
Result := False;
end;
function OctToDec(Value: String): LongInt;
var
I: Integer;
begin
Result:= 0;
for I:= 1 to Length(Value) do
Result:= Result * 8 + StrToInt(Copy(Value, I, 1));
end;
function DecToOct(Value: LongInt): String;
var
iMod: Integer;
begin
Result := '';
while Value >= 8 do
begin
iMod:= Value mod 8;
Value:= Value div 8;
Result:= IntToStr(iMod) + Result;
end;
Result:= IntToStr(Value) + Result;
end;
procedure AddString(var anArray: TDynamicStringArray; const sToAdd: String);
var
Len: Integer;
begin
Len := Length(anArray);
SetLength(anArray, Len + 1);
anArray[Len] := sToAdd;
end;
function ArrBegins(const Array1, Array2: array of String; BothWays: Boolean): Boolean;
var
Len1, Len2: Integer;
i: Integer;
begin
Len1 := Length(Array1);
Len2 := Length(Array2);
if not BothWays and (Len1 < Len2) then
Result := False
else
begin
if Len1 > Len2 then
Len1 := Len2;
for i := 0 to Len1 - 1 do
if Array1[i] <> Array2[i] then
Exit(False);
Result := True;
end;
end;
function ArrayToString(const anArray: TDynamicStringArray; const Separator: Char): String;
var
i: Integer;
begin
Result := '';
for i := Low(anArray) to High(anArray) do
AddStrWithSep(Result, anArray[i], Separator);
end;
function Compare(const Array1, Array2: array of String): Boolean;
var
Len1, Len2: Integer;
i: Integer;
begin
Len1 := Length(Array1);
Len2 := Length(Array2);
if Len1 <> Len2 then
Result := False
else
begin
for i := 0 to Len1 - 1 do
if Array1[i] <> Array2[i] then
Exit(False);
Result := True;
end;
end;
function CopyArray(const anArray: array of String): TDynamicStringArray;
var
i: Integer;
begin
SetLength(Result, Length(anArray));
for i := Low(anArray) to High(anArray) do
Result[i] := anArray[i];
end;
function ContainsOneOf(const ArrayToSearch, StringsToSearch: array of String): Boolean;
var
i: Integer;
begin
for i := Low(StringsToSearch) to High(StringsToSearch) do
if Contains(ArrayToSearch, StringsToSearch[i]) then
Exit(True);
Result := False;
end;
function Contains(const ArrayToSearch: array of String; const StringToSearch: String): Boolean;
var
i: Integer;
begin
for i := Low(ArrayToSearch) to High(ArrayToSearch) do
if ArrayToSearch[i] = StringToSearch then
Exit(True);
Result := False;
end;
procedure DeleteString(var anArray: TDynamicStringArray; const Index: Integer);
var
Len: Integer;
i: Integer;
begin
Len := Length(anArray);
for i := Index + 1 to Len - 1 do
anArray[i - 1] := anArray[i];
SetLength(anArray, Len - 1);
end;
procedure DeleteString(var anArray: TDynamicStringArray; const sToDelete: String);
var
i: Integer;
begin
for i := Low(anArray) to High(anArray) do
if anArray[i] = sToDelete then
begin
DeleteString(anArray, i);
Exit;
end;
end;
procedure SetValue(var anArray: TDynamicStringArray; Key, NewValue: String);
var
i: Integer;
begin
Key := Key + '=';
for i := Low(anArray) to High(anArray) do
if StrBegins(anArray[i], Key) then
begin
anArray[i] := Key + NewValue;
Exit;
end;
AddString(anArray, Key + NewValue);
end;
procedure SetValue(var anArray: TDynamicStringArray; Key: String; NewValue: Boolean);
begin
if NewValue then
SetValue(anArray, Key, 'true')
else
SetValue(anArray, Key, 'false');
end;
function ShortcutsToText(const Shortcuts: TDynamicStringArray): String;
begin
Result := ArrayToString(Shortcuts, ' ');
end;
end.

View file

@ -21,7 +21,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
}
unit KASXmlConfig;
unit DCXmlConfig;
{$mode objfpc}{$H+}
@ -35,8 +35,6 @@ type
TXmlNode = TDOMNode;
TXmlPath = DOMString;
{ TXmlConfig }
TXmlConfig = class
private
FFileName: UTF8String;
@ -139,7 +137,7 @@ type
implementation
uses
LCLProc, KASClassesEx, URIParser;
LCLProc, DCOSUtils, DCClassesUtf8, URIParser;
const
BoolStrings: array[Boolean] of DOMString = ('False', 'True');
@ -167,7 +165,7 @@ begin
begin
if (FFileName <> '') and SaveOnDestroy then
Save;
FreeThenNil(FDoc);
FreeAndNil(FDoc);
end;
inherited Destroy;
@ -175,7 +173,7 @@ end;
procedure TXmlConfig.Clear;
begin
FreeThenNil(FDoc);
FreeAndNil(FDoc);
FDoc := TXMLDocument.Create;
FDoc.AppendChild(FDoc.CreateElement(ApplicationName));
end;

View file

@ -0,0 +1,65 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="4">
<PathDelim Value="\"/>
<Name Value="doublecmd_common"/>
<Author Value="Alexander Koblov"/>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
</Checks>
</CodeGeneration>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Description Value="Common units for Double Commander"/>
<License Value="GNU GPL 2"/>
<Version Minor="1"/>
<Files Count="4">
<Item1>
<Filename Value="dcclassesutf8.pas"/>
<UnitName Value="DCClassesUtf8"/>
</Item1>
<Item2>
<Filename Value="dcosutils.pas"/>
<UnitName Value="DCOSUtils"/>
</Item2>
<Item3>
<Filename Value="dcstrutils.pas"/>
<UnitName Value="DCStrUtils"/>
</Item3>
<Item4>
<Filename Value="dcbasictypes.pas"/>
<UnitName Value="DCBasicTypes"/>
</Item4>
</Files>
<RequiredPkgs Count="1">
<Item1>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item1>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
</Package>
</CONFIG>

View file

@ -0,0 +1,14 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit doublecmd_common;
interface
uses
DCClassesUtf8, DCOSUtils, DCStrUtils, DCBasicTypes;
implementation
end.

View file

@ -0,0 +1,62 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="4">
<PathDelim Value="\"/>
<Name Value="doublecmd_common_lcl"/>
<Author Value="Alexander Koblov"/>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<SearchPaths>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Parsing>
<SyntaxOptions>
<IncludeAssertionCode Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
<Checks>
<RangeChecks Value="True"/>
<OverflowChecks Value="True"/>
</Checks>
</CodeGeneration>
<Other>
<CompilerMessages>
<MsgFileName Value=""/>
</CompilerMessages>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
<Description Value="Common units for Double Commander
This package uses LCL"/>
<License Value="GNU GPL 2"/>
<Version Minor="1"/>
<Files Count="1">
<Item1>
<Filename Value="dcxmlconfig.pas"/>
<UnitName Value="DCXmlConfig"/>
</Item1>
</Files>
<RequiredPkgs Count="3">
<Item1>
<PackageName Value="doublecmd_common"/>
<MinVersion Minor="1" Valid="True"/>
</Item1>
<Item2>
<PackageName Value="LCL"/>
<MinVersion Major="1" Valid="True"/>
</Item2>
<Item3>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item3>
</RequiredPkgs>
<UsageOptions>
<UnitPath Value="$(PkgOutDir)"/>
</UsageOptions>
<PublishOptions>
<Version Value="2"/>
</PublishOptions>
</Package>
</CONFIG>

View file

@ -0,0 +1,14 @@
{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
unit doublecmd_common_lcl;
interface
uses
DCXmlConfig;
implementation
end.

View file

@ -54,7 +54,7 @@ uses
{$IFDEF MSWindows}
LCLIntf,
{$ENDIF}
uGlobsPaths, uGlobs, uDCUtils, uOSUtils, StrUtils;
uGlobsPaths, uGlobs, DCStrUtils, DCOSUtils, StrUtils;
{ TdmHelpManager }
@ -87,4 +87,4 @@ begin
end;
end.

View file

@ -76,8 +76,8 @@ implementation
{$R *.lfm}
uses
Graphics, SynEditTypes, uHighlighterProcs, uXMLConfig, uGlobsPaths,
uClassesEx, uOSUtils, uLng
Graphics, SynEditTypes, uHighlighterProcs, DCXmlConfig, uGlobsPaths,
DCClassesUtf8, DCOSUtils, uLng
{$IF lcl_fullversion >= 093100}
, SynHighlighterPo
{$ENDIF}

View file

@ -234,7 +234,7 @@
<LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="10">
<RequiredPackages Count="12">
<Item1>
<PackageName Value="dcpcrypt"/>
</Item1>
@ -271,8 +271,16 @@
<Item10>
<PackageName Value="viewerpackage"/>
</Item10>
<Item11>
<PackageName Value="doublecmd_common"/>
<MinVersion Minor="1" Valid="True"/>
</Item11>
<Item12>
<PackageName Value="doublecmd_common_lcl"/>
<MinVersion Minor="1" Valid="True"/>
</Item12>
</RequiredPackages>
<Units Count="162">
<Units Count="163">
<Unit0>
<Filename Value="doublecmd.lpr"/>
<IsPartOfProject Value="True"/>
@ -484,6 +492,7 @@
<Filename Value="fcolumnssetconf.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="fColumnsSetConf"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fColumnsSetConf"/>
</Unit27>
@ -491,6 +500,7 @@
<Filename Value="fhackform.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmHackForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fHackForm"/>
</Unit28>
@ -519,6 +529,7 @@
<Filename Value="fdescredit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmDescrEdit"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fDescrEdit"/>
</Unit32>
@ -600,6 +611,7 @@
<Filename Value="fchecksumcalc.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmCheckSumCalc"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fCheckSumCalc"/>
</Unit46>
@ -841,6 +853,7 @@
<Filename Value="fattributesedit.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmAttributesEdit"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fAttributesEdit"/>
</Unit92>
@ -905,6 +918,7 @@
<Filename Value="newdesign\ffilesystemcopymoveoperationoptions.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="FileSystemCopyMoveOperationOptionsUI"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fFileSystemCopyMoveOperationOptions"/>
</Unit102>
@ -920,6 +934,7 @@
<Filename Value="newdesign\fwfxplugincopymoveoperationoptions.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="WfxPluginCopyMoveOperationOptionsUI"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fWfxPluginCopyMoveOperationOptions"/>
</Unit104>
@ -947,6 +962,7 @@
<Filename Value="frames\foptionstooltips.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsToolTips"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsToolTips"/>
</Unit109>
@ -962,6 +978,7 @@
<Filename Value="frames\foptionsplugins.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsPlugins"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsPlugins"/>
</Unit111>
@ -969,6 +986,7 @@
<Filename Value="frames\foptionsfiletypescolors.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsFileTypesColors"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsFileTypesColors"/>
</Unit112>
@ -1006,6 +1024,7 @@
<Filename Value="frames\foptionslanguage.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsLanguage"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsLanguage"/>
</Unit119>
@ -1013,6 +1032,7 @@
<Filename Value="frames\foptionsbehavior.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsBehavior"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsBehavior"/>
</Unit120>
@ -1020,6 +1040,7 @@
<Filename Value="frames\foptionstools.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsViewer"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsTools"/>
</Unit121>
@ -1027,6 +1048,7 @@
<Filename Value="frames\foptionshotkeys.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsHotkeys"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsHotkeys"/>
</Unit122>
@ -1034,6 +1056,7 @@
<Filename Value="frames\foptionslayout.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsLayout"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsLayout"/>
</Unit123>
@ -1041,6 +1064,7 @@
<Filename Value="frames\foptionsfonts.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsFonts"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsFonts"/>
</Unit124>
@ -1048,6 +1072,7 @@
<Filename Value="frames\foptionsfileoperations.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsFileOperations"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsFileOperations"/>
</Unit125>
@ -1055,6 +1080,7 @@
<Filename Value="frames\foptionsquicksearchfilter.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsQuickSearchFilter"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsQuickSearchFilter"/>
</Unit126>
@ -1062,6 +1088,7 @@
<Filename Value="frames\foptionstabs.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsTabs"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsTabs"/>
</Unit127>
@ -1069,6 +1096,7 @@
<Filename Value="frames\foptionslog.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsLog"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsLog"/>
</Unit128>
@ -1076,6 +1104,7 @@
<Filename Value="frames\foptionsconfiguration.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsConfiguration"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsConfiguration"/>
</Unit129>
@ -1083,6 +1112,7 @@
<Filename Value="frames\foptionscustomcolumns.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsCustomColumns"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsCustomColumns"/>
</Unit130>
@ -1090,6 +1120,7 @@
<Filename Value="frames\foptionsmisc.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsMisc"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsMisc"/>
</Unit131>
@ -1097,6 +1128,7 @@
<Filename Value="frames\foptionsautorefresh.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsAutoRefresh"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsAutoRefresh"/>
</Unit132>
@ -1104,6 +1136,7 @@
<Filename Value="frames\foptionsicons.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsIcons"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsIcons"/>
</Unit133>
@ -1111,6 +1144,7 @@
<Filename Value="frames\foptionsignorelist.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsIgnoreList"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsIgnoreList"/>
</Unit134>
@ -1118,6 +1152,7 @@
<Filename Value="frames\foptionsarchivers.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsArchivers"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsArchivers"/>
</Unit135>
@ -1125,6 +1160,7 @@
<Filename Value="fselecttextrange.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmSelectTextRange"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fSelectTextRange"/>
</Unit136>
@ -1142,6 +1178,7 @@
<Filename Value="frames\fquicksearch.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmQuickSearch"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fQuickSearch"/>
</Unit139>
@ -1154,6 +1191,7 @@
<Filename Value="frames\foptionsfilepanelscolors.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsFilePanelsColors"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsFilePanelsColors"/>
</Unit141>
@ -1161,6 +1199,7 @@
<Filename Value="frames\foptionstoolbase.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsToolBase"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsToolBase"/>
</Unit142>
@ -1168,6 +1207,7 @@
<Filename Value="frames\foptionsterminal.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsTerminal"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsTerminal"/>
</Unit143>
@ -1175,6 +1215,7 @@
<Filename Value="frames\foptionsmouse.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsMouse"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsMouse"/>
</Unit144>
@ -1182,6 +1223,7 @@
<Filename Value="frames\foptionskeyboard.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsKeyboard"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsKeyboard"/>
</Unit145>
@ -1189,6 +1231,7 @@
<Filename Value="frames\foptionsdragdrop.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsDragDrop"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsDragDrop"/>
</Unit146>
@ -1196,6 +1239,7 @@
<Filename Value="frames\foptionsfilesviews.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsFilesViews"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsFilesViews"/>
</Unit147>
@ -1203,6 +1247,7 @@
<Filename Value="frames\foptionscolumnsview.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsColumnsView"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsColumnsView"/>
</Unit148>
@ -1210,6 +1255,7 @@
<Filename Value="frames\foptionsdriveslistbutton.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsDrivesListButton"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsDrivesListButton"/>
</Unit149>
@ -1247,13 +1293,16 @@
<Filename Value="frames\foptionseditorcolors.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmOptionsEditorColors"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
<UnitName Value="fOptionsEditorColors"/>
</Unit156>
<Unit157>
<Filename Value="newdesign\fmultiarchivecopyoperationoptions.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MultiArchiveCopyOperationOptionsUI"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Frame"/>
</Unit157>
<Unit158>
<Filename Value="newdesign\fwcxarchivecopyoperationoptions.pas"/>
@ -1277,9 +1326,15 @@
<Filename Value="foptionshotkeysedithotkey.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="frmEditHotkey"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="fOptionsHotkeysEditHotkey"/>
</Unit161>
<Unit162>
<Filename Value="ukastoolitemsextended.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="uKASToolItemsExtended"/>
</Unit162>
</Units>
</ProjectOptions>
<CompilerOptions>

View file

@ -202,9 +202,10 @@ implementation
uses
LCLProc, LCLType, LConvEncoding, StrUtils, HelpIntfs, fViewer, fMain,
uLng, uGlobs, uShowForm, uOSUtils, uSearchTemplate, uDCUtils,
uLng, uGlobs, uShowForm, uSearchTemplate, uDCUtils,
uSearchResultFileSource, uFile, uFileSystemFileSource,
uFileViewNotebook, uFileView, uColumnsFileView, uKeyboard;
uFileViewNotebook, uFileView, uColumnsFileView, uKeyboard,
DCOSUtils;
const
TimeUnitToComboIndex: array[TTimeUnit] of Integer = (0, 1, 2, 3, 4, 5, 6);
@ -1188,4 +1189,4 @@ end;
finalization
FreeAndNil(GfrmFindDlgInstance);
end.
end.

View file

@ -217,7 +217,7 @@ implementation
{$R *.lfm}
uses
uLng, uFileSystemFileSource, uOSUtils, uDCUtils,
uLng, uFileSystemFileSource, DCOSUtils, uDCUtils,
uFileFunctions;
const

View file

@ -149,7 +149,7 @@ implementation
{$R *.lfm}
uses
LCLProc, LCLType, HelpIntfs, uClassesEx, uOSForms, uPixMapManager, uLng,
LCLProc, LCLType, HelpIntfs, DCClassesUtf8, uOSForms, uPixMapManager, uLng,
uGlobsPaths, uGlobs, uDCUtils, uOSUtils, uHotkeyManager, uKeyboard, fMain;
function ShowConfigToolbar(const aBarFileName: UTF8String; iButtonIndex : Integer = -1): Boolean;

View file

@ -93,7 +93,7 @@ implementation
{$R *.lfm}
uses
fMain, LCLType, LCLVersion, uGlobs, uLng, uHotkeyManager, uDCUtils;
fMain, LCLType, LCLVersion, uGlobs, uLng, uHotkeyManager, DCStrUtils;
const
HotkeysCategory = 'Copy/Move Dialog';
@ -405,4 +405,4 @@ end;
initialization
TFormCommands.RegisterCommandsForm(TfrmCopyDlg, HotkeysCategory, @rsHotkeyCategoryCopyMoveDialog);
end.
end.

View file

@ -98,7 +98,7 @@ function SendDlgMsg(pDlg: PtrUInt; DlgItemName: PAnsiChar; Msg, wParam, lParam:
implementation
uses
uShowMsg, uClassesEx;
uShowMsg, DCClassesUtf8;
function InputBox(Caption, Prompt: PAnsiChar; MaskInput: LongBool; Value: PAnsiChar; ValueMaxLen: Integer): LongBool; dcpcall;
var

View file

@ -237,7 +237,7 @@ implementation
uses
LCLProc, LConvEncoding, SynEditTypes, uHash, uLng, uGlobs, uShowMsg,
uBinaryCompare, uClassesEx, dmCommonData, uOSUtils;
uBinaryCompare, DCClassesUtf8, dmCommonData, DCOSUtils;
{$R *.lfm}
@ -981,4 +981,4 @@ begin
end;
end.

View file

@ -70,7 +70,7 @@ implementation
uses
Dialogs,
uGlobs, uDCUtils, uShowMsg, uLng,
uGlobs, uDCUtils, uShowMsg, uLng, DCStrUtils,
uFileSourceOperation,
uFileSystemFileSource,
uArchiveFileSourceUtil,
@ -299,4 +299,4 @@ begin
end;
end.

View file

@ -139,7 +139,8 @@ implementation
{$R *.lfm}
uses
LCLType, uGlobsPaths, uGlobs, uPixMapManager, uLng, uOSUtils, uDCUtils;
LCLType, uGlobsPaths, uGlobs, uPixMapManager, uLng, uDCUtils,
DCOSUtils, DCStrUtils;
var
frmFileAssoc: TfrmFileAssoc = nil;

View file

@ -57,7 +57,7 @@ implementation
{$R *.lfm}
uses
LCLProc, uTempFileSystemFileSource, uFileSourceOperation, uShellExecute, uOSUtils;
LCLProc, uTempFileSystemFileSource, uFileSourceOperation, uShellExecute, DCOSUtils;
function ShowFileExecuteYourSelf(aFileView: TFileView; aFile: TFile; bWithAll: Boolean): Boolean;
var
@ -133,4 +133,4 @@ begin
end;
end.

View file

@ -31,7 +31,7 @@ interface
uses
LResources, SysUtils, Classes, Graphics, Forms, StdCtrls, Buttons, ComCtrls,
Dialogs, Controls, ExtCtrls, uTypes, uFile, uFileProperty, uFileSource,
Dialogs, Controls, ExtCtrls, DCBasicTypes, uFile, uFileProperty, uFileSource,
uFileSourceOperation, uFileSourceCalcStatisticsOperation;
type
@ -144,7 +144,7 @@ uses
LCLType, FileUtil, StrUtils, uLng, BaseUnix, uUsersGroups, uDCUtils, uOSUtils,
uDefaultFilePropertyFormatter, uMyUnix, uFileAttributes,
uFileSourceOperationTypes, uFileSystemFileSource, uOperationsManager,
uFileSourceOperationOptions, uKeyboard;
uFileSourceOperationOptions, uKeyboard, DCStrUtils;
procedure ShowFileProperties(aFileSource: IFileSource; const aFiles: TFiles);
begin

View file

@ -38,7 +38,7 @@ implementation
{$R *.lfm}
uses
FileUtil, uLng, uGlobs, uLog, uShowMsg, uOSUtils, uDCUtils;
FileUtil, uLng, uGlobs, uLog, uShowMsg, uOSUtils, DCStrUtils;
function ShowHardLinkForm(const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
begin
@ -116,4 +116,4 @@ begin
edtLinkToCreate.SelectAll;
end;
end.
end.

View file

@ -46,7 +46,7 @@ implementation
{$R *.lfm}
uses
Dialogs, uDCUtils, uGlobs, uLng;
Dialogs, DCStrUtils, uGlobs, uLng;
procedure TfrmHotDir.LoadFromGlob;
begin

View file

@ -42,11 +42,11 @@ interface
uses
Graphics, Forms, Menus, Controls, StdCtrls, ExtCtrls, ActnList,
Buttons, SysUtils, Classes, SynEdit, LCLType, ComCtrls,
KASToolBar, KASXmlConfig, uCmdBox, uFilePanelSelect, uBriefFileView,
KASToolBar, uCmdBox, uFilePanelSelect, uBriefFileView,
uFileView, uColumnsFileView, uFileSource, uFileViewNotebook, uFile,
uOperationsManager, uFileSourceOperation, uDrivesList, uTerminal, uClassesEx,
uXmlConfig, uDrive, uDriveWatcher, uDCVersion, uMainCommands, uFormCommands,
uOperationsPanel, KASToolItems, uKASToolItemsExtended, IniFiles
uOperationsManager, uFileSourceOperation, uDrivesList, uTerminal, DCClassesUtf8,
DCXmlConfig, uDrive, uDriveWatcher, uDCVersion, uMainCommands, uFormCommands,
uOperationsPanel, KASToolItems, uKASToolItemsExtended
{$IF DEFINED(LCLQT)}
, Qt4, QtWidgets
{$ELSEIF DEFINED(LCLGTK2)}
@ -674,7 +674,7 @@ uses
uFileSourceProperty, uFileSourceExecuteOperation, uArchiveFileSource,
uShellExecute, fSymLink, fHardLink, uExceptions, uUniqueInstance, Clipbrd,
uFileSourceOperationOptionsUI, uDebug, uHotkeyManager, uFileSourceUtil,
XMLRead
XMLRead, DCOSUtils, DCStrUtils
{$IFDEF COLUMNSFILEVIEW_VTV}
, uColumnsFileViewVtv
{$ENDIF}
@ -1637,7 +1637,7 @@ begin
MainToolBar.Clear;
ToolBarNode := gConfig.FindNode(gConfig.RootNode, 'Toolbars/MainToolbar', False);
if Assigned(ToolBarNode) then
MainToolBar.LoadConfiguration(KASXmlConfig.TXmlConfig(gConfig), ToolBarNode, ToolBarLoader);
MainToolBar.LoadConfiguration(gConfig, ToolBarNode, ToolBarLoader);
finally
ToolBarLoader.Free;
MainToolBar.EndUpdate;
@ -4473,7 +4473,7 @@ var
begin
ToolBarNode := gConfig.FindNode(gConfig.RootNode, 'Toolbars/MainToolbar', True);
gConfig.ClearNode(ToolBarNode);
MainToolBar.SaveConfiguration(KASXmlConfig.TXmlConfig(gConfig), ToolBarNode);
MainToolBar.SaveConfiguration(gConfig, ToolBarNode);
end;
function TfrmMain.IsCommandLineVisible: Boolean;
@ -5005,4 +5005,4 @@ initialization
TFormCommands.RegisterCommandsForm(TfrmMain, HotkeysCategory, @rsHotkeyCategoryMain);
end.

View file

@ -19,7 +19,7 @@ interface
uses
SysUtils, Classes, Graphics, Forms, StdCtrls, Menus, SynRegExpr,
uClassesEx, uFile, uFileSource, StringHashList, Grids, ExtCtrls, uXmlConfig;
DCClassesUtf8, uClassesEx, uFile, uFileSource, StringHashList, Grids, ExtCtrls, DCXmlConfig;
type
@ -218,7 +218,7 @@ implementation
{$R *.lfm}
uses
LCLProc, FileUtil, uDebug, uLng, uGlobs, uFileProcs, uDCUtils, uOSUtils,
LCLProc, FileUtil, uDebug, uLng, uGlobs, uFileProcs, DCOSUtils, DCStrUtils,
fSelectTextRange, uShowMsg, uFileSourceUtil, uFileProperty, uFileFunctions;
const
@ -1192,4 +1192,4 @@ begin
end;
end.

View file

@ -29,7 +29,7 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls, Buttons,
uHotkeyManager, uTypes;
uHotkeyManager, DCBasicTypes;
type
@ -97,7 +97,7 @@ implementation
{$R *.lfm}
uses
HelpIntfs, LCLType, uKeyboard, uLng, uGlobs, uFormCommands, uDCUtils,
HelpIntfs, LCLType, uKeyboard, uLng, uGlobs, uFormCommands, DCStrUtils,
uPixMapManager;
const

View file

@ -93,7 +93,8 @@ implementation
uses
StrUtils, WcxPlugin, uGlobs, uDCUtils, uFileSourceOperation, uLng, uOSUtils,
uOperationsManager, uArchiveFileSourceUtil, uMultiArchiveFileSource,
uWcxArchiveCopyInOperation, uMultiArchiveCopyInOperation, uMasks;
uWcxArchiveCopyInOperation, uMultiArchiveCopyInOperation, uMasks,
DCStrUtils;
function ShowPackDlg(const SourceFileSource: IFileSource;
const TargetFileSource: IArchiveFileSource;

View file

@ -58,7 +58,7 @@ implementation
{$R *.lfm}
uses
uDCUtils, uGlobs, uLng;
DCStrUtils, uGlobs, uLng;
{ TfrmOptionsColumnsView }
@ -98,4 +98,4 @@ begin
end;
end.

View file

@ -71,7 +71,7 @@ implementation
{$R *.lfm}
uses
uDCUtils, uGlobs, uLng, fOptionsHotkeys;
DCStrUtils, uGlobs, uLng, fOptionsHotkeys;
{ TfrmOptionsFileOperations }
@ -155,4 +155,4 @@ begin
end;
end.

View file

@ -74,7 +74,7 @@ implementation
{$R *.lfm}
uses
uDCUtils, uGlobs, uLng, uTypes;
DCStrUtils, uGlobs, uLng, uTypes;
{ TfrmOptionsFilesViews }
@ -179,4 +179,4 @@ begin
end;
end.

View file

@ -28,7 +28,7 @@ interface
uses
Classes, SysUtils, ExtCtrls, StdCtrls, Grids,
fOptionsFrame, fOptionsHotkeysEditHotkey, uHotkeyManager, uTypes;
fOptionsFrame, fOptionsHotkeysEditHotkey, uHotkeyManager, DCBasicTypes;
type
@ -120,7 +120,7 @@ implementation
uses
Forms, Controls, Dialogs, LCLProc, LCLVersion,
uFindEx, uGlobs, uGlobsPaths, uLng, uKeyboard, uFormCommands, uDCUtils;
uFindEx, uGlobs, uGlobsPaths, uLng, uKeyboard, uFormCommands, DCStrUtils;
const
stgCmdCommandIndex = 0;
@ -975,4 +975,4 @@ begin
end;
end.

View file

@ -51,7 +51,7 @@ implementation
{$R *.lfm}
uses
uDebug, uFindEx, uTypes, uGlobs, uGlobsPaths, uLng;
uDebug, uFindEx, uGlobs, uGlobsPaths, uLng;
{ TfrmOptionsLanguage }
@ -110,4 +110,4 @@ begin
end;
end.

View file

@ -58,7 +58,7 @@ implementation
{$R *.lfm}
uses
uDCUtils, uGlobs, uLng;
DCStrUtils, uGlobs, uLng;
{ TfrmOptionsMouse }
@ -112,4 +112,4 @@ begin
end;
end.

View file

@ -91,7 +91,7 @@ implementation
uses
LCLProc, Dialogs, StrUtils, uLng, uGlobs, uDCUtils, uDebug, uShowMsg, uTypes,
fTweakPlugin, dmCommonData;
fTweakPlugin, dmCommonData, DCStrUtils;
{ TfrmOptionsPlugins }
@ -638,4 +638,4 @@ begin
end;
end.

View file

@ -65,7 +65,7 @@ implementation
uses
ExtCtrls {Lazarus < 31552},
uDCUtils, uLng, uGlobs;
DCStrUtils, uLng, uGlobs;
{ TfrmOptionsTabs }
@ -141,4 +141,4 @@ begin
end;
end.

View file

@ -87,7 +87,6 @@ implementation
uses
uKeyboard,
uGlobs,
uDCUtils,
uFormCommands;
const
@ -134,8 +133,6 @@ begin
end;
function GetBoolState(const Value: String; OldState: Boolean): Boolean;
var
BoolValue: Boolean;
begin
if Value = TOGGLE_VALUE then
Result := not OldState
@ -578,4 +575,4 @@ begin
end;
end.

View file

@ -28,7 +28,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, ExtCtrls, StdCtrls, Buttons,
EditBtn, uFileSourceSetFilePropertyOperation, uTypes, ZVDateTimePicker;
EditBtn, uFileSourceSetFilePropertyOperation, DCBasicTypes, ZVDateTimePicker;
type
@ -115,7 +115,7 @@ implementation
{$R *.lfm}
uses
LCLType, uFileAttributes, uDCUtils, uFileProperty;
LCLType, uFileAttributes, DCStrUtils, uDCUtils, uFileProperty;
function ShowChangeFilePropertiesDialog(const aOperation: TFileSourceSetFilePropertyOperation): Boolean;
begin

View file

@ -65,8 +65,8 @@ implementation
{$R *.lfm}
uses
LCLProc, uLng, uOSUtils, uFileProcs, uOperationsManager,
uFileSourceSplitOperation, uShowMsg;
LCLProc, uLng, uFileProcs, uOperationsManager,
uFileSourceSplitOperation, uShowMsg, DCOSUtils;
function ShowSplitterFileForm(aFileSource: IFileSource; var aFile: TFile; const TargetPath: UTF8String): Boolean;
var

View file

@ -38,7 +38,7 @@ implementation
{$R *.lfm}
uses
FileUtil, uLng, uGlobs, uLog, uShowMsg, uOSUtils, uDCUtils;
FileUtil, uLng, uGlobs, uLog, uShowMsg, uOSUtils, DCStrUtils;
function ShowSymLinkForm(const sExistingFile, sLinkToCreate, CurrentPath: String): Boolean;
begin
@ -116,4 +116,4 @@ begin
edtLinkToCreate.SelectAll;
end;
end.
end.

View file

@ -40,7 +40,7 @@ uses
SysUtils, Classes, Graphics, Controls, Forms, ExtCtrls, ComCtrls,
LCLProc, Menus, Dialogs, ExtDlgs, StdCtrls, Buttons, ColorBox, Spin,
Grids, ActnList, viewercontrol, GifAnim, fFindView, WLXPlugin, uWLXModule,
uFileSource, fModView, uOSUtils, Types, uThumbnails, uFormCommands;
uFileSource, fModView, Types, uThumbnails, uFormCommands;
type
@ -313,8 +313,9 @@ implementation
{$R *.lfm}
uses
FileUtil, IntfGraphics, uLng, uShowMsg, uGlobs, LCLType, LConvEncoding, uClassesEx,
uFindMmap, uDCUtils, LCLIntf, uDebug, uHotkeyManager, uConvEncoding;
FileUtil, IntfGraphics, uLng, uShowMsg, uGlobs, LCLType, LConvEncoding, DCClassesUtf8,
uFindMmap, DCStrUtils, uDCUtils, LCLIntf, uDebug, uHotkeyManager, uConvEncoding,
DCOSUtils, uOSUtils;
const
HotkeysCategory = 'Viewer';
@ -2245,4 +2246,4 @@ initialization
TFormCommands.RegisterCommandsForm(TfrmViewer, HotkeysCategory, @rsHotkeyCategoryViewer);
end.

View file

@ -5,7 +5,7 @@ unit uFileProperty;
interface
uses
Classes, SysUtils, uTypes;
Classes, SysUtils, DCBasicTypes;
type
@ -385,7 +385,7 @@ type
implementation
uses
uOSUtils, uFileAttributes, uDefaultFilePropertyFormatter;
DCOSUtils, uFileAttributes, uDefaultFilePropertyFormatter;
resourcestring
rsSizeDescription = 'Size';

View file

@ -23,7 +23,7 @@ implementation
uses
uShowMsg,
uLng,
uDCUtils,
DCStrUtils,
uFileSourceProperty,
uWcxArchiveFileSource,
uMultiArchiveFileSource,
@ -236,4 +236,4 @@ begin
end;
end.

View file

@ -7,8 +7,8 @@ interface
uses
LMessages, Grids, uFileView, uFileSource, Graphics,
Classes, SysUtils, Controls, ExtCtrls, ComCtrls, contnrs, fgl,
uFile, uDisplayFile, uFormCommands, uDragDropEx, uXmlConfig,
uClassesEx, uFileSorting, uFileViewHistory, uFileProperty, uFileViewWorker,
uFile, uDisplayFile, uFormCommands, uDragDropEx, DCXmlConfig,
DCClassesUtf8, uFileSorting, uFileViewHistory, uFileProperty, uFileViewWorker,
uFunctionThread, uFileSystemWatcher, fQuickSearch, uTypes, uFileViewHeader;
type
@ -809,4 +809,4 @@ begin
end;
end.

View file

@ -15,8 +15,8 @@ uses
uDisplayFile,
uColumns,
uFileSorting,
uXmlConfig,
uClassesEx,
DCXmlConfig,
DCClassesUtf8,
uTypes,
uFileViewWorker,
fQuickSearch,
@ -364,7 +364,7 @@ implementation
uses
LCLProc, uMasks, Clipbrd, uLng, uShowMsg, uGlobs, uPixmapManager, uDebug,
uDCUtils, uOSUtils, math, fMain, fOptions,
uDCUtils, uOSUtils, math, fMain, fOptions, DCOSUtils, DCStrUtils,
uInfoToolTip, dmCommonData,
uFileSourceProperty,
uFileSourceOperationTypes,
@ -3952,4 +3952,4 @@ begin
end;
end.

View file

@ -15,8 +15,8 @@ uses
uDisplayFile,
uColumns,
uFileSorting,
uXmlConfig,
uClassesEx,
DCXmlConfig,
DCClassesUtf8,
uFileViewWorker,
fQuickSearch,
uFileViewHeader,

View file

@ -41,7 +41,7 @@ var
implementation
uses
uGlobs, uDCUtils, uTypes
uGlobs, uDCUtils, DCBasicTypes
{$IFDEF UNIX}
, BaseUnix, Unix
{$ENDIF}
@ -214,4 +214,4 @@ finalization
MaxDetailsFilePropertyFormatter := nil;
end.

View file

@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils,
uFileProperty,
uTypes;
DCBasicTypes;
type

View file

@ -5,7 +5,7 @@ unit uFileAttributes;
interface
uses
Classes, SysUtils, uTypes;
Classes, SysUtils, DCBasicTypes;
const // Windows attributes
FILE_ATTRIBUTE_ARCHIVE = 32;
@ -87,7 +87,7 @@ const // Unix attributes
implementation
uses
uDCUtils;
DCStrUtils;
type
TAttrStrToFileAttr = record
@ -161,9 +161,7 @@ begin
if sAttr[1] in ['0'..'7'] then
begin
// Octal representation.
{$PUSH}{$R-,Q-}
Exit(OctToDec(sAttr));
{$POP}
Exit(TFileAttrs(OctToDec(sAttr)));
end
else
begin
@ -233,4 +231,4 @@ begin
end;
end.

View file

@ -5,7 +5,7 @@ unit uFileSource;
interface
uses
Classes, SysUtils, uDCUtils, syncobjs, LCLProc,
Classes, SysUtils, DCStrUtils, syncobjs, LCLProc,
uFileSourceOperation,
uFileSourceOperationTypes,
uFileSourceProperty,
@ -497,7 +497,7 @@ end;
function TFileSource.GetParentDir(sPath : String): String;
begin
Result := uDCUtils.GetParentDir(sPath);
Result := DCStrUtils.GetParentDir(sPath);
end;
function TFileSource.GetRootDir(sPath : String): String;
@ -914,4 +914,4 @@ finalization
FreeAndNil(FileSourceManager);
end.

View file

@ -56,7 +56,7 @@ type
implementation
uses
uDCUtils, uLng;
DCStrUtils, uLng;
constructor TFileSourceCreateDirectoryOperation.Create(
aTargetFileSource: IFileSource;
@ -112,4 +112,4 @@ begin
end;
end.

View file

@ -36,7 +36,7 @@ implementation
uses
LCLProc, fFileExecuteYourSelf, uGlobs, uShellExecute, uFindEx, uDebug,
uOSUtils, uShowMsg, uTypes, uLng, uDCUtils, uVfsModule,
uOSUtils, uShowMsg, uLng, uVfsModule, DCOSUtils, DCStrUtils,
uFileSourceOperation,
uFileSourceSetFilePropertyOperation,
uFileSourceExecuteOperation,
@ -317,4 +317,4 @@ begin
end;
end.

View file

@ -11,7 +11,7 @@ uses
uFileSourceOperationOptions,
uFileSourceOperationUI,
uFile,
uGlobs, uLog, uHash, uClassesEx;
uGlobs, uLog, uHash, DCClassesUtf8;
type
@ -52,10 +52,8 @@ type
implementation
uses
uDCUtils, uOSUtils, uLng,
uFileSystemUtil, LCLProc,
FileUtil, StrUtils,
uFileSystemFileSource;
LCLProc, StrUtils, FileUtil,
uLng, uFileSystemUtil, uFileSystemFileSource, DCOSUtils, DCStrUtils;
type
TChecksumEntry = class

View file

@ -37,7 +37,7 @@ type
implementation
uses
uFileSourceOperationOptions, uOSUtils, uLng, uFindEx, uTypes,
uFileSourceOperationOptions, uOSUtils, uLng, uFindEx,
uFileSystemFileSource;
constructor TFileSystemCalcStatisticsOperation.Create(
@ -197,4 +197,4 @@ begin
end;
end.

View file

@ -10,7 +10,7 @@ uses
uFileSource,
uFileSourceOperationUI,
uFile,
uGlobs, uLog, uClassesEx;
uGlobs, uLog, DCClassesUtf8;
type
@ -45,7 +45,7 @@ type
implementation
uses
uOSUtils, uLng, uFileSystemUtil, LCLProc;
uOSUtils, DCOSUtils, uLng, uFileSystemUtil, LCLProc;
constructor TFileSystemCombineOperation.Create(aFileSource: IFileSource;
var theSourceFiles: TFiles;

View file

@ -27,7 +27,7 @@ type
implementation
uses
uFileSourceOperationUI, uFileProcs, uLog, uLng, uGlobs, uOSUtils;
uFileSourceOperationUI, uFileProcs, uLog, uLng, uGlobs, DCOSUtils;
constructor TFileSystemCreateDirectoryOperation.Create(
aTargetFileSource: IFileSource;

View file

@ -59,7 +59,7 @@ type
implementation
uses
uOSUtils, uLng, uFileSystemUtil, uTrash;
DCOSUtils, uLng, uFileSystemUtil, uTrash;
constructor TFileSystemDeleteOperation.Create(aTargetFileSource: IFileSource;
var theFilesToDelete: TFiles);

View file

@ -40,7 +40,7 @@ type
implementation
uses
Forms, Controls, uOSUtils;
Forms, Controls, DCOSUtils, uOSUtils;
constructor TFileSystemExecuteOperation.Create(
aTargetFileSource: IFileSource;
@ -81,4 +81,4 @@ begin
end;
end.

View file

@ -5,7 +5,7 @@ unit uFileSystemFileSource;
interface
uses
Classes, SysUtils, uDCUtils,
Classes, SysUtils,
uFileSourceOperation,
uFileSourceOperationTypes,
uLocalFileSource,
@ -14,7 +14,9 @@ uses
uFileProperty,
uFile,
uDescr,
uTypes
DCBasicTypes,
DCStrUtils,
uFindEx
;
type
@ -118,12 +120,12 @@ type
implementation
uses
uOSUtils, uDateTimeUtils, uGlobs,
uOSUtils, DCOSUtils, uDateTimeUtils, uGlobs,
{$IFDEF MSWINDOWS}
uMyWindows, Windows,
{$ENDIF}
{$IFDEF UNIX}
BaseUnix, uUsersGroups, FileUtil, uMyUnix, uFindEx,
BaseUnix, uUsersGroups, FileUtil, uMyUnix,
{$ENDIF}
uFileSystemListOperation,
uFileSystemCopyOperation,
@ -675,12 +677,12 @@ begin
sPath := ExcludeTrailingPathDelimiter(Path);
if (Pos('\\', sPath) = 1) and (NumCountChars(PathDelim, sPath) = 3) then
Exit(True);
Result := (uDCUtils.GetParentDir(Path) = '');
Result := (DCStrUtils.GetParentDir(Path) = '');
end;
function TFileSystemFileSource.GetRootDir(sPath : String): String;
begin
Result := uDCUtils.GetRootDir(sPath);
Result := DCStrUtils.GetRootDir(sPath);
end;
function TFileSystemFileSource.GetRootDir: String;
@ -690,7 +692,7 @@ end;
function TFileSystemFileSource.GetPathType(sPath : String): TPathType;
begin
Result := uDCUtils.GetPathType(sPath);
Result := DCStrUtils.GetPathType(sPath);
end;
function TFileSystemFileSource.GetFreeSpace(Path: String; out FreeSize, TotalSize : Int64) : Boolean;
@ -875,4 +877,4 @@ begin
end;
end.

View file

@ -21,7 +21,7 @@ type
implementation
uses
uFile, uFindEx, uOSUtils, uTypes, uFileSystemFileSource;
uFile, uFindEx, uOSUtils, uFileSystemFileSource;
constructor TFileSystemListOperation.Create(aFileSource: IFileSource; aPath: String);
begin
@ -70,4 +70,4 @@ begin
end;
end.

View file

@ -44,8 +44,8 @@ type
implementation
uses
uGlobs, uOSUtils, uDCUtils, uLng, uDateTimeUtils, uFileSystemUtil, uTypes,
uFileSourceOperationUI
uGlobs, uLng, uDateTimeUtils, uFileSystemUtil,
uFileSourceOperationUI, DCOSUtils, DCStrUtils, DCBasicTypes
{$IF DEFINED(MSWINDOWS)}
, Windows, ShellAPI, LCLProc
{$ELSEIF DEFINED(UNIX)}
@ -240,7 +240,7 @@ function TFileSystemSetFilePropertyOperation.RenameFile(const OldName: UTF8Strin
var
sQuestion: String;
begin
if uOSUtils.FPS_ISDIR(Attrs) then
if DCOSUtils.FPS_ISDIR(Attrs) then
sQuestion := rsMsgFolderExistsRwrt
else
sQuestion := rsMsgFileExistsRwrt;

View file

@ -10,7 +10,7 @@ uses
uFileSource,
uFileSourceOperationUI,
uFile,
uGlobs, uLog, uClassesEx;
uGlobs, uLog, DCClassesUtf8;
type
@ -44,7 +44,7 @@ type
implementation
uses
uOSUtils, uLng, LCLProc;
uOSUtils, DCOSUtils, uLng, LCLProc;
constructor TFileSystemSplitOperation.Create(aFileSource: IFileSource;
var aSourceFile: TFile;

View file

@ -171,8 +171,8 @@ type
implementation
uses
uDebug, uOSUtils, uDCUtils, FileUtil, uFindEx, uClassesEx, uFileProcs, uLng,
uTypes, uFileSource, uFileSystemFileSource, uFileProperty, uDateTimeUtils;
uDebug, uOSUtils, DCOSUtils, DCStrUtils, FileUtil, uFindEx, DCClassesUtf8, uFileProcs, uLng,
DCBasicTypes, uFileSource, uFileSystemFileSource, uFileProperty, uDateTimeUtils;
procedure SplitFileMask(const DestMask: String; out DestNameMask: String; out DestExtMask: String);
var
@ -1052,7 +1052,7 @@ begin
CorrectedLink := GetAbsoluteFileName(aFile.Path, LinkTarget);
// If the link was relative - make also the corrected link relative.
if uDCUtils.GetPathType(LinkTarget) = ptRelative then
if GetPathType(LinkTarget) = ptRelative then
LinkTarget := ExtractRelativepath(AbsoluteTargetFileName, CorrectedLink)
else
LinkTarget := CorrectedLink;

View file

@ -94,7 +94,7 @@ type
implementation
uses
uDebug, uOSUtils, uLng, uFindEx, uClassesEx, uFileSystemUtil, LCLProc, uTypes;
uDebug, uLng, uFindEx, DCClassesUtf8, uFileSystemUtil, DCOSUtils;
constructor TFileSystemWipeOperation.Create(aTargetFileSource: IFileSource;
var theFilesToWipe: TFiles);
@ -231,8 +231,8 @@ begin
Exit;
end;
fs := TFilestreamEx.Create(FileName, fmOpenReadWrite or fmShareExclusive);
try
fs := TFilestreamEx.Create(FileName, fmOpenReadWrite or fmShareExclusive);
for i := 1 to pass do
begin
//---------------Progress--------------
@ -269,11 +269,11 @@ begin
end;
end;
FileTruncate(fs.Handle, 0);
FreeThenNil(fs);
FreeAndNil(fs);
except
on E: Exception do
begin
FreeThenNil(fs);
FreeAndNil(fs);
ShowError(E.Message);
Exit;
end;
@ -443,4 +443,4 @@ begin
end;
end.

View file

@ -6,8 +6,8 @@ interface
uses
Classes, SysUtils, Controls, ExtCtrls, ComCtrls, contnrs, fgl,
uFile, uDisplayFile, uFileSource, uFormCommands, uDragDropEx, uXmlConfig,
uClassesEx, uFileSorting, uFileViewHistory, uFileProperty, uFileViewWorker,
uFile, uDisplayFile, uFileSource, uFormCommands, uDragDropEx, DCXmlConfig,
DCClassesUtf8, uFileSorting, uFileViewHistory, uFileProperty, uFileViewWorker,
uFunctionThread, uFileSystemWatcher, fQuickSearch, StringHashList, uGlobs;
type
@ -475,7 +475,7 @@ implementation
uses
Dialogs, LCLProc, Forms, StrUtils, uMasks, fMaskInputDlg,
uDebug, uLng, uShowMsg, uFileSystemFileSource, uFileSourceUtil,
uDCUtils, uFileViewNotebook, uSearchTemplate, uOSUtils;
uFileViewNotebook, uSearchTemplate, uOSUtils, DCStrUtils;
const
MinimumReloadInterval = 1000; // 1 second
@ -2486,4 +2486,4 @@ begin
end;
end.

View file

@ -56,7 +56,8 @@ type
implementation
uses
LCLType, ShellCtrls, uDCUtils, uOSUtils, fMain, uFileSourceUtil;
LCLType, ShellCtrls, uDCUtils, DCOSUtils, DCStrUtils,
fMain, uFileSourceUtil;
{ TFileViewHeader }
@ -316,4 +317,4 @@ begin
end;
end.

View file

@ -227,7 +227,7 @@ implementation
uses
{$IFDEF timeFileView} uDebug, {$ENDIF}
LCLProc,
uFileSourceOperationTypes, uOSUtils, uDCUtils, uExceptions,
uFileSourceOperationTypes, uOSUtils, DCStrUtils, uDCUtils, uExceptions,
uGlobs, uMasks, uPixMapManager, uFileSourceProperty,
uFileSourceCalcStatisticsOperation,
uFileSourceOperationOptions;
@ -921,4 +921,4 @@ begin
end;
end.

View file

@ -35,7 +35,7 @@ type
implementation
uses
uMultiArc, uDCUtils;
uMultiArc, DCStrUtils;
constructor TMultiArchiveCalcStatisticsOperation.Create(
aTargetFileSource: IFileSource;

View file

@ -70,8 +70,8 @@ type
implementation
uses
LCLProc, uDCUtils, uMultiArc, uLng, WcxPlugin, uFileSourceOperationUI,
uFileSystemFileSource, uFileSystemUtil, uMultiArchiveUtil, uOSUtils, uTarWriter;
LCLProc, DCStrUtils, uDCUtils, uMultiArc, uLng, WcxPlugin, uFileSourceOperationUI,
uFileSystemFileSource, uFileSystemUtil, uMultiArchiveUtil, DCOSUtils, uOSUtils, uTarWriter;
constructor TMultiArchiveCopyInOperation.Create(aSourceFileSource: IFileSource;
aTargetFileSource: IFileSource;

View file

@ -93,8 +93,8 @@ type
implementation
uses
LCLProc, FileUtil, uOSUtils, uDCUtils, uMultiArc, uFileSourceOperationUI, fMultiArchiveCopyOperationOptions,
uMultiArchiveUtil, uFileProcs, uLng, uDateTimeUtils, uTypes, uShowMsg;
LCLProc, FileUtil, uOSUtils, DCOSUtils, DCStrUtils, uMultiArc, uFileSourceOperationUI, fMultiArchiveCopyOperationOptions,
uMultiArchiveUtil, uFileProcs, uLng, uDateTimeUtils, DCBasicTypes, uShowMsg;
constructor TMultiArchiveCopyOutOperation.Create(aSourceFileSource: IFileSource;
aTargetFileSource: IFileSource;
@ -590,4 +590,4 @@ begin
end;
end.

View file

@ -53,7 +53,7 @@ type
implementation
uses
uOSUtils, uDCUtils, uLng, uMultiArc, uMultiArchiveUtil, LCLProc;
uOSUtils, DCOSUtils, uLng, uMultiArc, uMultiArchiveUtil, LCLProc;
constructor TMultiArchiveDeleteOperation.Create(aTargetFileSource: IFileSource;
var theFilesToDelete: TFiles);
@ -233,4 +233,4 @@ begin
end;
end;
end.
end.

View file

@ -8,7 +8,7 @@ uses
Classes, SysUtils, contnrs, StringHashList, uOSUtils,
uMultiArc, uFile, uFileSourceProperty, uFileSourceOperationTypes,
uArchiveFileSource, uFileProperty, uFileSource, uFileSourceOperation,
uMultiArchiveUtil, uTypes;
uMultiArchiveUtil, DCBasicTypes;
type
@ -119,8 +119,8 @@ type
implementation
uses
uDebug, uGlobs, uFileAttributes,
FileUtil, uMasks, uDCUtils,
uDebug, uGlobs, uFileAttributes, DCOSUtils, DCStrUtils,
FileUtil, uMasks,
uMultiArchiveListOperation,
uMultiArchiveCopyInOperation,
uMultiArchiveCopyOutOperation,
@ -581,4 +581,4 @@ begin
end;
end.

View file

@ -23,7 +23,7 @@ type
implementation
uses
LCLProc, uOSUtils, uDCUtils, uMultiArc, uFile;
LCLProc, uOSUtils, DCStrUtils, uMultiArc, uFile;
constructor TMultiArchiveListOperation.Create(aFileSource: IFileSource; aPath: String);
begin

View file

@ -53,7 +53,7 @@ type
implementation
uses
uOSUtils, uDCUtils, uLng, uMultiArc, uMultiArchiveUtil, LCLProc;
uOSUtils, DCOSUtils, uLng, uMultiArc, uMultiArchiveUtil, LCLProc;
constructor TMultiArchiveTestArchiveOperation.Create(aTargetFileSource: IFileSource;
var theFilesToDelete: TFiles);
@ -234,4 +234,4 @@ begin
end;
end;
end.
end.

View file

@ -7,7 +7,7 @@ unit uMultiArchiveUtil;
interface
uses
Classes, SysUtils, uMultiArc, un_process, uFile, uTypes;
Classes, SysUtils, uMultiArc, un_process, uFile, DCBasicTypes;
const
MAF_UNIX_PATH = 1; // Use Unix path delimiter (/)
@ -81,8 +81,8 @@ function FormatArchiverCommand(const Archiver, sCmd, anArchiveName: UTF8String;
implementation
uses
LCLProc, FileUtil, StrUtils, uClassesEx, uDCUtils, uOSUtils, uDateTimeUtils,
uDebug, uFileAttributes;
LCLProc, FileUtil, StrUtils, DCClassesUtf8, uDCUtils, DCOSUtils, uOSUtils,
uDateTimeUtils, uDebug, uFileAttributes;
function GetUnixFileName(const Str: String): UTF8String;
var

View file

@ -23,7 +23,7 @@ type
implementation
uses
uOSUtils, uDCUtils, uFile, uFileProperty;
uOSUtils, DCStrUtils, uFile, uFileProperty;
constructor TMultiListListOperation.Create(aFileSource: IFileSource; aPath: String);
begin
@ -87,4 +87,4 @@ end;
end.

View file

@ -64,7 +64,7 @@ type
implementation
uses
uOSUtils, uDCUtils, uFileProcs;
DCOSUtils, uOSUtils, DCStrUtils, uFileProcs;
constructor TTempFileSystemFileSource.Create;
begin
@ -135,7 +135,7 @@ begin
if IsPathAtRoot(sPath) then
Result := ''
else
Result := uDCUtils.GetParentDir(sPath);
Result := DCStrUtils.GetParentDir(sPath);
end;
function TTempFileSystemFileSource.GetRootDir(sPath: String): String;

View file

@ -35,7 +35,7 @@ type
implementation
uses
uOSUtils, uWcxModule, uDCUtils;
DCOSUtils, uWcxModule, DCStrUtils;
constructor TWcxArchiveCalcStatisticsOperation.Create(
aTargetFileSource: IFileSource;

View file

@ -63,8 +63,8 @@ type
implementation
uses
LCLProc, FileUtil, uDCUtils, uWCXmodule, uLng, uShowMsg,
uFileSystemFileSource, uFileSourceOperationUI, uFileSystemUtil, uOSUtils, uTarWriter;
LCLProc, FileUtil, DCStrUtils, uWCXmodule, uLng, uShowMsg,
uFileSystemFileSource, uFileSourceOperationUI, uFileSystemUtil, DCOSUtils, uTarWriter;
// ----------------------------------------------------------------------------
// WCX callbacks

View file

@ -90,9 +90,9 @@ type
implementation
uses
LCLProc, uMasks, FileUtil, contnrs, uOSUtils, uDCUtils, uShowMsg,
LCLProc, uMasks, FileUtil, contnrs, DCOSUtils, DCStrUtils, uDCUtils, uShowMsg,
uFileSourceOperationUI, fWcxArchiveCopyOperationOptions, uWCXmodule,
uFileProcs, uLng, uDateTimeUtils, uTypes;
uFileProcs, uLng, uDateTimeUtils, DCBasicTypes;
// ----------------------------------------------------------------------------
// WCX callbacks
@ -652,4 +652,4 @@ begin
end;
end.

View file

@ -50,7 +50,7 @@ type
implementation
uses
uOSUtils, uDCUtils, uLng, uShowMsg, uWCXmodule, WcxPlugin, uMasks,
DCOSUtils, DCStrUtils, uDCUtils, uLng, uShowMsg, uWCXmodule, WcxPlugin, uMasks,
FileUtil, LCLProc;
// ----------------------------------------------------------------------------
@ -305,4 +305,4 @@ begin
WcxDeleteOperation := nil;
end;
end.
end.

View file

@ -6,7 +6,7 @@ unit uWcxArchiveFileSource;
interface
uses
Classes, SysUtils, contnrs, syncobjs, StringHashList, uOSUtils,
Classes, SysUtils, contnrs, syncobjs, StringHashList,
WcxPlugin, uWCXmodule, uFile, uFileSourceProperty, uFileSourceOperationTypes,
uArchiveFileSource, uFileProperty, uFileSource, uFileSourceOperation;
@ -143,7 +143,7 @@ type
implementation
uses
LCLProc, uDebug, uDCUtils, uGlobs,
LCLProc, uDebug, DCStrUtils, uDCUtils, uGlobs, DCOSUtils, uOSUtils,
uDateTimeUtils,
FileUtil, uCryptProc,
uWcxArchiveListOperation,
@ -954,4 +954,4 @@ finalization
FreeThenNil(WcxOperationsQueueLock);
end.

View file

@ -23,7 +23,7 @@ type
implementation
uses
uOSUtils, uDCUtils, uWCXmodule, uFile;
uOSUtils, DCStrUtils, uWCXmodule, uFile;
constructor TWcxArchiveListOperation.Create(aFileSource: IFileSource; aPath: String);
begin

View file

@ -47,7 +47,7 @@ type
implementation
uses
FileUtil, uOSUtils, uDCUtils, uShowMsg, uFileSourceOperationUI,
FileUtil, DCOSUtils, DCStrUtils, uDCUtils, uShowMsg, uFileSourceOperationUI,
uWCXmodule, uLng;
// ----------------------------------------------------------------------------
@ -352,4 +352,4 @@ begin
end;
end.

View file

@ -47,7 +47,7 @@ type
implementation
uses
uOSUtils, uLng, WfxPlugin;
DCOSUtils, uLng, WfxPlugin;
constructor TWfxPluginDeleteOperation.Create(aTargetFileSource: IFileSource;
var theFilesToDelete: TFiles);

View file

@ -153,7 +153,7 @@ threadvar
implementation
uses
LCLProc, FileUtil, StrUtils, {} LCLType, uShowMsg, {} uGlobs, uDCUtils, uLog,
LCLProc, FileUtil, StrUtils, {} LCLType, uShowMsg, {} uGlobs, DCStrUtils, uDCUtils, uLog,
uDebug, uLng, uCryptProc, uFileAttributes, uConnectionManager, contnrs, syncobjs,
uWfxPluginCopyInOperation, uWfxPluginCopyOutOperation, uWfxPluginMoveOperation,
uWfxPluginExecuteOperation, uWfxPluginListOperation, uWfxPluginCreateDirectoryOperation,
@ -1046,4 +1046,4 @@ finalization
FreeThenNil(WfxOperationsQueue);
FreeThenNil(WfxOperationsQueueLock);
end.
end.

View file

@ -33,7 +33,7 @@ type
implementation
uses
uOSUtils, uDCUtils, uFile, WfxPlugin, uWfxModule, uLog, uLng;
uOSUtils, DCStrUtils, uFile, WfxPlugin, uWfxModule, uLog, uLng;
function TWfxPluginListOperation.UpdateProgress(SourceName, TargetName: UTF8String;
PercentDone: Integer): Integer;

View file

@ -44,7 +44,7 @@ type
implementation
uses
uTypes, uDCUtils, WfxPlugin, uWfxPluginUtil, uDateTimeUtils;
DCBasicTypes, DCStrUtils, WfxPlugin, uWfxPluginUtil, uDateTimeUtils;
constructor TWfxPluginSetFilePropertyOperation.Create(aTargetFileSource: IFileSource;
var theTargetFiles: TFiles;

View file

@ -81,8 +81,8 @@ type
implementation
uses
uFileProcs, uDCUtils, uLng, uWfxModule, uFileSystemUtil, uFileProperty,
uDateTimeUtils, uTypes;
uFileProcs, DCStrUtils, uLng, uWfxModule, uFileSystemUtil, uFileProperty,
uDateTimeUtils, DCBasicTypes;
function WfxRenameFile(aFileSource: IWfxPluginFileSource; const aFile: TFile; const NewFileName: UTF8String): Boolean;
var

View file

@ -38,7 +38,7 @@ type
implementation
uses
Windows, JwaWinNetWk, uDCUtils, uOSUtils;
Windows, JwaWinNetWk, DCStrUtils, DCOSUtils;
constructor TWinNetExecuteOperation.Create(aTargetFileSource: IFileSource;
var aExecutableFile: TFile; aCurrentPath, aVerb: UTF8String);

View file

@ -78,7 +78,7 @@ implementation
uses
LCLProc, uWinNetListOperation, uWinNetExecuteOperation,
Windows, JwaWinNetWk, uVfsModule, uShowMsg, uOSUtils, uDCUtils;
Windows, JwaWinNetWk, uVfsModule, uShowMsg, DCOSUtils, DCStrUtils;
function TWinNetFileSource.GetParentDir(sPath: String): String;
var
@ -117,7 +117,7 @@ end;
function TWinNetFileSource.IsPathAtRoot(Path: String): Boolean;
begin
Result := (uDCUtils.GetParentDir(Path) = '');
Result := (DCStrUtils.GetParentDir(Path) = '');
end;
function TWinNetFileSource.GetRootDir(sPath: String): String;

View file

@ -25,8 +25,8 @@ type
implementation
uses
LCLProc, uFile, Windows, JwaWinNetWk, uDCUtils, uShowMsg,
uOSUtils;
LCLProc, uFile, Windows, JwaWinNetWk, DCStrUtils, uShowMsg,
DCOSUtils, uOSUtils;
type
PNetResourceArray = ^TNetResource;

File diff suppressed because it is too large Load diff

View file

@ -26,7 +26,7 @@ unit uDateTimeUtils;
interface
uses
Classes, SysUtils, uTypes
Classes, SysUtils, DCBasicTypes
{$IF DEFINED(MSWINDOWS)}
, Windows
{$ELSEIF DEFINED(UNIX)}
@ -34,19 +34,19 @@ uses
{$ENDIF}
;
function FileTimeToDateTime(FileTime : uTypes.TFileTime) : TDateTime;
function DateTimeToFileTime(DateTime : TDateTime) : uTypes.TFileTime;
function FileTimeToDateTime(FileTime : DCBasicTypes.TFileTime) : TDateTime;
function DateTimeToFileTime(DateTime : TDateTime) : DCBasicTypes.TFileTime;
{en
Converts system specific UTC time to local time.
}
function FileTimeToLocalFileTime(const FileTime: uTypes.TFileTime;
out LocalFileTime: uTypes.TFileTime): LongBool;
function FileTimeToLocalFileTime(const FileTime: DCBasicTypes.TFileTime;
out LocalFileTime: DCBasicTypes.TFileTime): LongBool;
{en
Converts system specific local time to UTC time.
}
function LocalFileTimeToFileTime(const LocalFileTime: uTypes.TFileTime;
out FileTime: uTypes.TFileTime): LongBool;
function LocalFileTimeToFileTime(const LocalFileTime: DCBasicTypes.TFileTime;
out FileTime: DCBasicTypes.TFileTime): LongBool;
{en
Converts Windows UTC file time to Windows local file time.
@param(lpFileTime TWinFileTime structure containing the UTC-based file time)
@ -117,72 +117,72 @@ const { Short names of months. }
const
SecsPerHour = SecsPerMin * MinsPerHour;
function AdjustUnixTime(const FileTime: uTypes.TFileTime;
out AdjustedFileTime: uTypes.TFileTime;
function AdjustUnixTime(const FileTime: DCBasicTypes.TFileTime;
out AdjustedFileTime: DCBasicTypes.TFileTime;
AdjustValue: Int64): Boolean;
begin
if AdjustValue < 0 then
begin
if FileTime < uTypes.TFileTime(-AdjustValue) then
if FileTime < DCBasicTypes.TFileTime(-AdjustValue) then
begin
AdjustedFileTime := 0;
Result := False;
end
else
begin
AdjustedFileTime := FileTime - uTypes.TFileTime(-AdjustValue);
AdjustedFileTime := FileTime - DCBasicTypes.TFileTime(-AdjustValue);
Result := True;
end;
end
else
begin
if High(FileTime) - FileTime < uTypes.TFileTime(AdjustValue) then
if High(FileTime) - FileTime < DCBasicTypes.TFileTime(AdjustValue) then
begin
AdjustedFileTime := High(FileTime);
Result := False;
end
else
begin
AdjustedFileTime := FileTime + uTypes.TFileTime(AdjustValue);
AdjustedFileTime := FileTime + DCBasicTypes.TFileTime(AdjustValue);
Result := True;
end;
end;
end;
function AdjustWinTime(const FileTime: uTypes.TWinFileTime;
out AdjustedFileTime: uTypes.TWinFileTime;
function AdjustWinTime(const FileTime: DCBasicTypes.TWinFileTime;
out AdjustedFileTime: DCBasicTypes.TWinFileTime;
AdjustValue: Int64): Boolean;
begin
if AdjustValue < 0 then
begin
if FileTime < uTypes.TWinFileTime(-AdjustValue) then
if FileTime < DCBasicTypes.TWinFileTime(-AdjustValue) then
begin
AdjustedFileTime := 0;
Result := False;
end
else
begin
AdjustedFileTime := FileTime - uTypes.TWinFileTime(-AdjustValue);
AdjustedFileTime := FileTime - DCBasicTypes.TWinFileTime(-AdjustValue);
Result := True;
end;
end
else
begin
if High(FileTime) - FileTime < uTypes.TWinFileTime(AdjustValue) then
if High(FileTime) - FileTime < DCBasicTypes.TWinFileTime(AdjustValue) then
begin
AdjustedFileTime := High(FileTime);
Result := False;
end
else
begin
AdjustedFileTime := FileTime + uTypes.TWinFileTime(AdjustValue);
AdjustedFileTime := FileTime + DCBasicTypes.TWinFileTime(AdjustValue);
Result := True;
end;
end;
end;
{$ENDIF}
function FileTimeToDateTime(FileTime : uTypes.TFileTime) : TDateTime;
function FileTimeToDateTime(FileTime : DCBasicTypes.TFileTime) : TDateTime;
{$IF DEFINED(MSWINDOWS)}
begin
Result := WinFileTimeToDateTime(FileTime);
@ -190,7 +190,7 @@ end;
{$ELSEIF DEFINED(UNIX)}
var
Hrs, Mins, Secs : Word;
TodaysSecs : uTypes.TFileTime;
TodaysSecs : DCBasicTypes.TFileTime;
begin
FileTimeToLocalFileTime(FileTime, FileTime);
@ -210,7 +210,7 @@ begin
end;
{$ENDIF}
function DateTimeToFileTime(DateTime : TDateTime) : uTypes.TFileTime;
function DateTimeToFileTime(DateTime : TDateTime) : DCBasicTypes.TFileTime;
{$IF DEFINED(MSWINDOWS)}
begin
Result := DateTimeToWinFileTime(DateTime);
@ -236,7 +236,7 @@ begin
{$POP}
{$IFDEF cpu32}
if BigTime > High(uTypes.TFileTime) then
if BigTime > High(DCBasicTypes.TFileTime) then
raise EConvertError.CreateFmt(rsMsgErrDateNotSupported, [DateTimeToStr(DateTime)])
else
{$ENDIF}
@ -248,8 +248,8 @@ begin
end;
{$ENDIF}
function FileTimeToLocalFileTime(const FileTime: uTypes.TFileTime;
out LocalFileTime: uTypes.TFileTime): LongBool;
function FileTimeToLocalFileTime(const FileTime: DCBasicTypes.TFileTime;
out LocalFileTime: DCBasicTypes.TFileTime): LongBool;
{$IFDEF MSWINDOWS}
begin
Result := Windows.FileTimeToLocalFileTime(@Windows.FILETIME(FileTime), @Windows.FILETIME(LocalFileTime));
@ -260,8 +260,8 @@ begin
end;
{$ENDIF}
function LocalFileTimeToFileTime(const LocalFileTime: uTypes.TFileTime;
out FileTime: uTypes.TFileTime): LongBool;
function LocalFileTimeToFileTime(const LocalFileTime: DCBasicTypes.TFileTime;
out FileTime: DCBasicTypes.TFileTime): LongBool;
{$IFDEF MSWINDOWS}
begin
Result := Windows.LocalFileTimeToFileTime(@Windows.FILETIME(LocalFileTime), @Windows.FILETIME(FileTime));
@ -414,4 +414,4 @@ begin
end;
end.

Some files were not shown because too many files have changed in this diff Show more