1
0
mirror of synced 2024-09-19 09:46:09 +00:00

Added: GetTempFile implementation

Changed: updated Delphi 7 package
This commit is contained in:
Mark van Renswoude 2008-03-17 09:33:24 +00:00
parent 6d5d37bdf8
commit 263c324676
6 changed files with 55 additions and 22 deletions

View File

@ -31,7 +31,7 @@
-M -M
-$M16384,1048576 -$M16384,1048576
-K$00400000 -K$00400000
-N"..\..\Lib\D7" -N"P:\Algemeen\lib"
-LE"c:\program files\borland\delphi7\Projects\Bpl" -LE"c:\program files\borland\delphi7\Projects\Bpl"
-LN"c:\program files\borland\delphi7\Projects\Bpl" -LN"c:\program files\borland\delphi7\Projects\Bpl"
-w-SYMBOL_PLATFORM -w-SYMBOL_PLATFORM

View File

@ -91,7 +91,7 @@ ImageBase=4194304
ExeDescription=X2Utils ExeDescription=X2Utils
[Directories] [Directories]
OutputDir= OutputDir=
UnitOutputDir=..\..\Lib\D7 UnitOutputDir=P:\Algemeen\lib
PackageDLLOutputDir= PackageDLLOutputDir=
PackageDCPOutputDir= PackageDCPOutputDir=
SearchPath= SearchPath=
@ -105,6 +105,10 @@ HostApplication=
Launcher= Launcher=
UseLauncher=0 UseLauncher=0
DebugCWD= DebugCWD=
[Language]
ActiveLang=
ProjectLang=
RootDir=
[Version Info] [Version Info]
IncludeVerInfo=1 IncludeVerInfo=1
AutoIncBuild=0 AutoIncBuild=0
@ -130,6 +134,8 @@ OriginalFilename=
ProductName= ProductName=
ProductVersion=1.0.0.0 ProductVersion=1.0.0.0
Comments= Comments=
[Excluded Packages]
C:\Program Files\Borland\Indy\D7\dclIndy70.bpl=Internet Direct (Indy) for D7 Property and Component Editors
[HistoryLists\hlUnitAliases] [HistoryLists\hlUnitAliases]
Count=1 Count=1
Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE; Item0=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
@ -138,11 +144,12 @@ Count=2
Item0=..\.. Item0=..\..
Item1=F:\Development\VDarts\Packages Item1=F:\Development\VDarts\Packages
[HistoryLists\hlUnitOutputDirectory] [HistoryLists\hlUnitOutputDirectory]
Count=4 Count=5
Item0=..\..\Lib\D7 Item0=P:\Algemeen\lib
Item1=..\..\Dcu Item1=..\..\Lib\D7
Item2=..\..\..\Dcu Item2=..\..\Dcu
Item3=Dcu Item3=..\..\..\Dcu
Item4=Dcu
[HistoryLists\hlBPLOutput] [HistoryLists\hlBPLOutput]
Count=3 Count=3
Item0=..\..\Lib\D7 Item0=..\..\Lib\D7

View File

@ -30,13 +30,10 @@ package X2Utils;
requires requires
rtl, rtl,
vcl, vcl,
VirtualTreesD7,
vclx, vclx,
indy, VirtualTreesD7;
xmlrtl;
contains contains
X2UtVirtualTree in '..\..\X2UtVirtualTree.pas',
X2UtApp in '..\..\X2UtApp.pas', X2UtApp in '..\..\X2UtApp.pas',
X2UtBits in '..\..\X2UtBits.pas', X2UtBits in '..\..\X2UtBits.pas',
X2UtGraphics in '..\..\X2UtGraphics.pas', X2UtGraphics in '..\..\X2UtGraphics.pas',
@ -45,8 +42,17 @@ contains
X2UtHashesVariants in '..\..\X2UtHashesVariants.pas', X2UtHashesVariants in '..\..\X2UtHashesVariants.pas',
X2UtMisc in '..\..\X2UtMisc.pas', X2UtMisc in '..\..\X2UtMisc.pas',
X2UtOS in '..\..\X2UtOS.pas', X2UtOS in '..\..\X2UtOS.pas',
X2UtSingleInstance in '..\..\X2UtSingleInstance.pas',
X2UtStrings in '..\..\X2UtStrings.pas', X2UtStrings in '..\..\X2UtStrings.pas',
X2UtInetVersion in '..\..\X2UtInetVersion.pas'; X2UtImageInfo in '..\..\X2UtImageInfo.pas',
X2UtTempFile in '..\..\X2UtTempFile.pas',
X2UtIniParser in '..\..\X2UtIniParser.pas',
X2UtProcess in '..\..\X2UtProcess.pas',
X2UtSingleInstance in '..\..\X2UtSingleInstance.pas',
X2UtStreams in '..\..\X2UtStreams.pas',
X2UtNamedFormat in '..\..\X2UtNamedFormat.pas',
X2UtPersist in '..\..\X2UtPersist.pas',
X2UtPersistForm in '..\..\X2UtPersistForm.pas',
X2UtPersistIntf in '..\..\X2UtPersistIntf.pas',
X2UtPersistRegistry in '..\..\X2UtPersistRegistry.pas';
end. end.

View File

@ -113,9 +113,8 @@ type
FFiler: IX2PersistFiler; FFiler: IX2PersistFiler;
FSectionCount: Integer; FSectionCount: Integer;
protected protected
property SectionCount: Integer read FSectionCount;
property Filer: IX2PersistFiler read FFiler; property Filer: IX2PersistFiler read FFiler;
property SectionCount: Integer read FSectionCount;
{ IInterface } { IInterface }

View File

@ -1,5 +1,5 @@
{ {
:: X2UtPersistRegistry implements persistency to the Windows Registry. :: X2UtPersistRegistry implements persistency to the Windows Registry.
:: ::
:: Last changed: $Date$ :: Last changed: $Date$
:: Revision: $Rev$ :: Revision: $Rev$

View File

@ -44,6 +44,22 @@ begin
end; end;
function GetTempFile(const APrefix: String): String; overload;
var
tempPath: array[0..MAX_PATH] of Char;
tempFile: array[0..MAX_PATH] of Char;
begin
FillChar(tempPath, SizeOf(tempPath), #0);
FillChar(tempFile, SizeOf(tempFile), #0);
Windows.GetTempPath(SizeOf(tempPath), @tempPath);
Windows.GetTempFileName(@tempPath, PChar(APrefix), 0, @tempFile);
Result := String(tempFile);
end;
function GetTempFile(const APath, AFileName, AExtension: String): String; overload; function GetTempFile(const APath, AFileName, AExtension: String): String; overload;
var var
iCounter: Integer; iCounter: Integer;
@ -53,7 +69,7 @@ var
begin begin
iCounter := 0; iCounter := 0;
sBase := IncludeTrailingPathDelimiter(APath); sBase := IncludeTrailingPathDelimiter(APath);
if not ForceDirectories(sBase) then if not ForceDirectories(sBase) then
begin begin
Result := ''; Result := '';
@ -74,6 +90,7 @@ begin
end; end;
end; end;
function GetTempFile(const APath, AFileName: String): String; overload; function GetTempFile(const APath, AFileName: String): String; overload;
var var
sExt: String; sExt: String;
@ -84,19 +101,22 @@ begin
sExt); sExt);
end; end;
function GetTempAppDataFile(const APath, AFileName, AExtension: String): String; overload;
function GetTempAppDataFile(const ASubPath, AFileName, AExtension: String): String; overload;
begin begin
Result := GetTempFile(GetAppDataPath + APath, AFileName, AExtension); Result := GetTempFile(GetAppDataPath + ASubPath, AFileName, AExtension);
end; end;
function GetTempAppDataFile(const APath, AFileName: String): String; overload;
function GetTempAppDataFile(const ASubPath, AFileName: String): String; overload;
var var
sExt: String; sExt: String;
begin begin
sExt := ExtractFileExt(AFileName); sExt := ExtractFileExt(AFileName);
Result := GetTempAppDataFile(APath, Copy(AFileName, 1, Length(AFileName) - Length(sExt)), Result := GetTempAppDataFile(ASubPath, Copy(AFileName, 1,
sExt); Length(AFileName) - Length(sExt)),
sExt);
end; end;
@ -105,6 +125,7 @@ begin
Result := not (AChar in ['\', '/', ':', '*', '?', '"', '<', '>', '|']); Result := not (AChar in ['\', '/', ':', '*', '?', '"', '<', '>', '|']);
end; end;
function CheckValidFileName(var AFileName: String; const AReplacement: Char): Boolean; function CheckValidFileName(var AFileName: String; const AReplacement: Char): Boolean;
var var
iPos: Integer; iPos: Integer;