renamed DirectoryExists to DirPathExists to reduce ambigiousity

git-svn-id: trunk@4925 -
This commit is contained in:
mattias 2003-12-21 13:58:06 +00:00
parent 457e1dd6d3
commit aa76552f75
25 changed files with 75 additions and 55 deletions

View File

@ -3148,7 +3148,7 @@ var
begin
//writeln('CreateFPCSrcTemplate ',FPCSrcDir,': ',length(UnitSearchPath),' Valid=',UnitLinkListValid,' PPUExt=',PPUExt);
Result:=nil;
if (FPCSrcDir='') or (not DirectoryExists(FPCSrcDir)) then exit;
if (FPCSrcDir='') or (not DirPathExists(FPCSrcDir)) then exit;
DS:=PathDelim;
Dir:=FPCSrcDir;
if Dir[length(Dir)]<>DS then Dir:=Dir+DS;

View File

@ -49,7 +49,7 @@ function CompareFilenames(const Filename1, Filename2: string): integer;
function CompareFileExt(const Filename, Ext: string;
CaseSensitive: boolean): integer;
function GetFilenameOnDisk(const AFilename: string): string;
function DirectoryExists(DirectoryName: string): boolean;
function DirPathExists(DirectoryName: string): boolean;
function ExtractFileNameOnly(const AFilename: string): string;
function FilenameIsAbsolute(TheFilename: string):boolean;
function ForceDirectory(DirectoryName: string): boolean;
@ -187,7 +187,7 @@ begin
Result:=AFilename;
end;
function DirectoryExists(DirectoryName: string): boolean;
function DirPathExists(DirectoryName: string): boolean;
var sr: TSearchRec;
begin
if (DirectoryName<>'')
@ -209,7 +209,7 @@ begin
while i<=length(DirectoryName) do begin
if DirectoryName[i]=PathDelim then begin
Dir:=copy(DirectoryName,1,i-1);
if not DirectoryExists(Dir) then begin
if not DirPathExists(Dir) then begin
Result:=CreateDir(Dir);
if not Result then exit;
end;

View File

@ -118,7 +118,7 @@ begin
TestGroupbox.Caption:='Test: Compiling an empty file ...';
// get Test directory
TestDir:=AppendPathDelim(EnvironmentOptions.TestBuildDirectory);
if not DirectoryExists(TestDir) then begin
if not DirPathExists(TestDir) then begin
MessageDlg('Invalid Test Directory',
'Please check the Test directory under'#13
+'Environment -> Environment Options -> Files -> Directory for building test projects',

View File

@ -271,7 +271,7 @@ var
FullFilename: String;
begin
Result:=false;
if (not DirectoryExists(MainDirectory)) or (Lvl>20) then exit;
if (not DirPathExists(MainDirectory)) or (Lvl>20) then exit;
if SysUtils.FindFirst(MainDirectory+FindMask,
faAnyFile,FileInfo)=0
then begin

View File

@ -612,7 +612,7 @@ function GetLazarusLanguageNames(aLangId : TLazarusLanguage) : String;
function CheckFileChanged(const OldFilename, NewFilename: string): boolean;
function CheckExecutable(const OldFilename, NewFilename: string;
const ErrorCaption, ErrorMsg: string): boolean;
function CheckDirectoryExists(const Dir,
function CheckDirPathExists(const Dir,
ErrorCaption, ErrorMsg: string): TModalResult;
function SimpleDirectoryCheck(const OldDir, NewDir,
NotFoundErrMsg: string; var StopChecking: boolean): boolean;
@ -697,10 +697,10 @@ begin
end;
end;
function CheckDirectoryExists(const Dir,
function CheckDirPathExists(const Dir,
ErrorCaption, ErrorMsg: string): TModalResult;
begin
if not DirectoryExists(Dir) then begin
if not DirPathExists(Dir) then begin
Result:=MessageDlg(ErrorCaption,Format(ErrorMsg,[Dir]),mtWarning,
[mbIgnore,mbCancel],0);
end else
@ -717,7 +717,7 @@ begin
Result:=true;
exit;
end;
SubResult:=CheckDirectoryExists(NewDir,lisEnvOptDlgDirectoryNotFound,
SubResult:=CheckDirPathExists(NewDir,lisEnvOptDlgDirectoryNotFound,
NotFoundErrMsg);
if SubResult=mrIgnore then begin
Result:=true;

View File

@ -387,7 +387,7 @@ begin
if WholeWordsOnlyCheckBox.Checked then Include(Result,fifWholeWord);
if RegularExpressionsCheckBox.Checked then Include(Result,fifRegExpr);
if IncludeSubDirsCheckBox.Checked then Include(Result,fifIncludeSubDirs);
case WhereRadioGroup.ItemIndex of
0: Include(Result,fifSearchProject);
1: Include(Result,fifSearchOpen);

View File

@ -361,7 +361,7 @@ var
TempDir: string;
begin
//if we have a list and a valid directory
if (DirectoryExists(TheFileName)) then
if (DirPathExists(TheFileName)) then
begin //make sure path ends with delimiter
TempDir:= AppendPathDelim(TheFileName);
for i:= 0 to fParsedMasks.Count -1 do
@ -374,7 +374,8 @@ begin
if (FileInfo.Name='.') or (FileInfo.Name='..')
or ((faDirectory and FileInfo.Attr)>0) then continue;
//Make sure this is a text file as it will be searched
if FileIsReadable(TempDir + FileInfo.Name)and FileIsText(TempDir + FileInfo.Name) then
if FileIsReadable(TempDir + FileInfo.Name)
and FileIsText(TempDir + FileInfo.Name) then
begin
UpdateProgress(TempDir + FileInfo.Name);
SearchFile(TempDir + FileInfo.Name);

View File

@ -776,9 +776,9 @@ begin
Result:=FileProcs.FilenameIsAbsolute(Filename);
end;
function DirectoryExists(DirectoryName: string): boolean;
function DirPathExists(DirectoryName: string): boolean;
begin
Result:=FileProcs.DirectoryExists(DirectoryName);
Result:=FileProcs.DirPathExists(DirectoryName);
end;
function ForceDirectory(DirectoryName: string): boolean;
@ -1858,7 +1858,7 @@ begin
DestDir:=AppendPathDelim(TrimFilename(DestDirectory));
if CompareFilenames(SrcDir,DestDir)=0 then exit;
if (not DirectoryExists(SrcDir))
if (not DirPathExists(SrcDir))
and not HandleError(ceSrcDirDoesNotExists,SrcDir,'') then exit;
CopyDir(SrcDir,DestDirectory);

View File

@ -350,7 +350,7 @@ end;
procedure TImExportCompOptsDlg.DoOpenFile(const AFilename: string);
begin
if DirectoryExists(AFilename) then exit;
if DirPathExists(AFilename) then exit;
Filename:=AFilename;
ImExportResult:=iecorImport;
ModalResult:=mrOk;
@ -360,7 +360,7 @@ procedure TImExportCompOptsDlg.DoSaveFile(const AFilename: string);
var
MsgResult: TModalResult;
begin
if DirectoryExists(AFilename) then exit;
if DirPathExists(AFilename) then exit;
Filename:=AFilename;
if FileExists(AFilename) then begin
MsgResult:=MessageDlg('Export file exists',

View File

@ -162,8 +162,8 @@ end;
function GetDefaultTestBuildDirectory: string;
begin
Result:='/tmp/';
if not DirectoryExists(Result) then begin
if DirectoryExists('/var/tmp/') then
if not DirPathExists(Result) then begin
if DirPathExists('/var/tmp/') then
Result:='/var/tmp/';
end;
end;

View File

@ -154,7 +154,7 @@ begin
Result:=GetEnv('TEMP');
if Result<>'' then exit;
Result:='c:\temp\';
if DirectoryExists(Result) then exit;
if DirPathExists(Result) then exit;
Result:='c:\windows\temp\';
end;
@ -187,6 +187,9 @@ end;
{
$Log$
Revision 1.20 2003/12/21 13:58:06 mattias
renamed DirectoryExists to DirPathExists to reduce ambigiousity
Revision 1.19 2003/12/20 01:20:52 mattias
splitted output directories for cross compilation

View File

@ -277,11 +277,11 @@ begin
if FTransferMacros<>nil then
Macros.SubstituteStr(Filename);
Filename:=ExpandFileName(Filename);
if (not (iftDirectory in CurFileFlags)) and DirectoryExists(Filename)
if (not (iftDirectory in CurFileFlags)) and DirPathExists(Filename)
then
exit;
if (not (iftFilename in CurFileFlags)) and FileExists(Filename)
and (not DirectoryExists(Filename))
and (not DirPathExists(Filename))
then
exit;
end;

View File

@ -1785,7 +1785,8 @@ resourcestring
lisFindFileDirectoryOptions = 'Directory options';
lisFindFileFileMaskBak = 'File mask (*, *.*, *.bak?)';
lisFindFileIncludeSubDirectories = 'Include sub directories';
lisFindFileOnlyTextFiles = 'Only text files';
// package manager
lisPkgMangPackage = 'Package: %s';
lisPkgMangProject = 'Project: %s';

View File

@ -109,11 +109,11 @@ var
Dir: String;
begin
Result:=false;
if DirectoryExists(ADirectory) then begin
if DirPathExists(ADirectory) then begin
Dir:=AppendPathDelim(ADirectory);
Result:=DirectoryExists(Dir+'fcl')
and DirectoryExists(Dir+'rtl')
and DirectoryExists(Dir+'packages');
Result:=DirPathExists(Dir+'fcl')
and DirPathExists(Dir+'rtl')
and DirPathExists(Dir+'packages');
end;
end;
@ -133,13 +133,13 @@ var
Dir: String;
begin
Result:=false;
if DirectoryExists(ADirectory) then begin
if DirPathExists(ADirectory) then begin
Dir:=AppendPathDelim(ADirectory);
Result:=DirectoryExists(Dir+'lcl')
and DirectoryExists(Dir+'lcl'+PathDelim+'units')
and DirectoryExists(Dir+'components')
and DirectoryExists(Dir+'designer')
and DirectoryExists(Dir+'debugger');
Result:=DirPathExists(Dir+'lcl')
and DirPathExists(Dir+'lcl'+PathDelim+'units')
and DirPathExists(Dir+'components')
and DirPathExists(Dir+'designer')
and DirPathExists(Dir+'debugger');
end;
end;
@ -150,6 +150,9 @@ end.
{
$Log$
Revision 1.23 2003/12/21 13:58:05 mattias
renamed DirectoryExists to DirPathExists to reduce ambigiousity
Revision 1.22 2003/12/20 01:20:52 mattias
splitted output directories for cross compilation

View File

@ -3059,7 +3059,7 @@ begin
// check file path
NewFilePath:=ExtractFilePath(NewFilename);
if not DirectoryExists(NewFilePath) then begin
if not DirPathExists(NewFilePath) then begin
ACaption:=lisEnvOptDlgDirectoryNotFound;
AText:=Format(lisTheDestinationDirectoryDoesNotExist, [#13, '"',
NewFilePath, '"']);
@ -3428,7 +3428,7 @@ begin
NewResFilePath:=NewFilePath
+copy(ResourceCode.Filename,length(OldFilePath)+1,
length(ResourceCode.Filename));
if not DirectoryExists(NewResFilePath) then
if not DirPathExists(NewResFilePath) then
NewResFilePath:=NewFilePath;
end else begin
// resource code was not in the same or in a sub dircetoy of source
@ -5743,7 +5743,7 @@ function TMainIDE.DoSaveProjectToTestDirectory: TModalResult;
begin
Result:=mrCancel;
if (EnvironmentOptions.TestBuildDirectory='')
or (not DirectoryExists(EnvironmentOptions.TestBuildDirectory)) then begin
or (not DirPathExists(EnvironmentOptions.TestBuildDirectory)) then begin
if (EnvironmentOptions.TestBuildDirectory<>'') then begin
MessageDlg(Format(lisTheTestDirectoryCouldNotBeFoundSeeEnvironmentOpt, [
#13, '"', EnvironmentOptions.TestBuildDirectory, '"', #13]), mtError, [
@ -6811,7 +6811,7 @@ begin
if BackupInfo.SubDirectory<>'' then begin
SubDir:=FilePath+BackupInfo.SubDirectory;
repeat
if not DirectoryExists(SubDir) then begin
if not DirPathExists(SubDir) then begin
if not CreateDir(SubDir) then begin
Result:=MessageDlg(Format(lisUnableToCreateBackupDirectory, ['"',
SubDir, '"'])
@ -7027,7 +7027,7 @@ begin
Result:=mrCancel;
exit;
end;
if DirectoryExists(DestDir) and (not DeleteDirectory(DestDir,true)) then
if DirPathExists(DestDir) and (not DeleteDirectory(DestDir,true)) then
begin
MessageDlg(lisUnableToCleanUpDestinationDirectory,
Format(lisUnableToCleanUpPleaseCheckPermissions, ['"', DestDir, '"', #13]
@ -8273,13 +8273,13 @@ begin
end;
if (EnvironmentOptions.LazarusDirectory='')
or not DirectoryExists(EnvironmentOptions.LazarusDirectory) then begin
or not DirPathExists(EnvironmentOptions.LazarusDirectory) then begin
writeln('');
writeln(
'NOTE: Lazarus Source Directory not set! (see Environment Options)');
end;
if (EnvironmentOptions.FPCSourceDirectory='')
or not DirectoryExists(EnvironmentOptions.FPCSourceDirectory) then begin
or not DirPathExists(EnvironmentOptions.FPCSourceDirectory) then begin
writeln('');
writeln('NOTE: FPC Source Directory not set! (see Environment Options)');
end;
@ -10247,6 +10247,9 @@ end.
{ =============================================================================
$Log$
Revision 1.682 2003/12/21 13:58:05 mattias
renamed DirectoryExists to DirPathExists to reduce ambigiousity
Revision 1.681 2003/12/20 11:10:35 mattias
fixed a few directory exists checks
@ -11932,7 +11935,7 @@ end.
Shane
Revision 1.130 2001/10/31 18:09:51 lazarus
MG: fixed DirectoryExists
MG: fixed DirPathExists
Revision 1.129 2001/10/31 16:29:20 lazarus
Fixed the gtk mousemove bug where the control gets the coord's based on it's parent instead of itself.

View File

@ -125,7 +125,7 @@ begin
Title:=lisPathEditSelectDirectory;
if (not Execute) then exit;
NewPath:=ExtractFilePath(Trim(Filename));
if (not DirectoryExists(NewPath)) then exit;
if (not DirPathExists(NewPath)) then exit;
y:=PathEdit.CaretY;
if y>PathEdit.Lines.Count then y:=PathEdit.Lines.Count;
PathEdit.Lines.Insert(y,NewPath);

View File

@ -352,7 +352,7 @@ begin
exit;
// check binaries
if IgnoreBinaries and (not DirectoryExists(AFilename))
if IgnoreBinaries and (not DirPathExists(AFilename))
and (not FileIsText(AFilename)) then exit;
Result:=true;

View File

@ -830,7 +830,7 @@ begin
OpenDialog.InitialDir:=ExtractFilePath(WorkingDirectoryEdit.Text);
OpenDialog.Filename:=HostApplicationEdit.Text;
if OpenDialog.Execute then begin
if (DirectoryExists(OpenDialog.Filename))
if (DirPathExists(OpenDialog.Filename))
or (MessageDlg(dlgDirectoryDoesNotExist ,
dlgTheDirectory +OpenDialog.Filename+dlgDoesNotExist ,
mtWarning,[mbIgnore,mbCancel],0)=mrIgnore) then

View File

@ -215,7 +215,7 @@ begin
FPreviewFilename := CurFilename;
FileIsValid := FileExists(FPreviewFilename)
and (not DirectoryExists(FPreviewFilename))
and (not DirPathExists(FPreviewFilename))
and FileIsReadable(FPreviewFilename);
if FileIsValid then
try

View File

@ -60,7 +60,7 @@ function ReadAllLinks(const Filename: string;
ExceptionOnError: boolean): string;
// directories
function DirectoryExists(const FileName: String): Boolean;
function DirPathExists(const FileName: String): Boolean;
function ForceDirectory(DirectoryName: string): boolean;
function DeleteDirectory(const DirectoryName: string;
OnlyChilds: boolean): boolean;
@ -127,6 +127,9 @@ end.
{
$Log$
Revision 1.20 2003/12/21 13:58:06 mattias
renamed DirectoryExists to DirPathExists to reduce ambigiousity
Revision 1.19 2003/10/31 14:25:59 mazen
* Fixing VER1_1 compile problem to allow using 1.1 compiler
* Most of oldlinux unit calls are now in BaseUnix unit with prefix Fp

View File

@ -4089,7 +4089,7 @@ procedure TStringGrid.DrawCell(aCol, aRow: Integer; aRect: TRect;
aState: TGridDrawState);
var
S: string;
ts: TTextStyle;
//ts: TTextStyle;
begin
inherited DrawCell(aCol, aRow, aRect, aState);
S:=Cells[aCol,aRow];

View File

@ -17,9 +17,9 @@
}
{------------------------------------------------------------------------------
DirectoryExists
DirPathExists
------------------------------------------------------------------------------}
function DirectoryExists(const FileName: String): Boolean;
function DirPathExists(const FileName: String): Boolean;
var
F: Longint;
dirExist: Boolean;
@ -632,7 +632,7 @@ begin
if not FileExists(AFilename) then begin
raise Exception.Create('file "'+AFilename+'" does not exist');
end;
if DirectoryExists(AFilename) then begin
if DirPathExists(AFilename) then begin
raise Exception.Create('file "'+AFilename+'" is a directory and not an executable');
end;
{$IFNDEF win32}
@ -671,7 +671,7 @@ begin
while i<=length(DirectoryName) do begin
if DirectoryName[i]=PathDelim then begin
Dir:=copy(DirectoryName,1,i-1);
if not DirectoryExists(Dir) then begin
if not DirPathExists(Dir) then begin
Result:=CreateDir(Dir);
if not Result then exit;
end;
@ -896,6 +896,9 @@ end;
{
$Log$
Revision 1.38 2003/12/21 13:58:06 mattias
renamed DirectoryExists to DirPathExists to reduce ambigiousity
Revision 1.37 2003/12/20 11:10:36 mattias
fixed a few directory exists checks

View File

@ -2111,7 +2111,7 @@ begin
gtk_file_selection_complete(PGtkFileSelection(theDialog.Handle),
AHistoryEntry^.Filename);
// restore filter
if DirectoryExists(AHistoryEntry^.Filename) then begin
if DirPathExists(AHistoryEntry^.Filename) then begin
FilterMenu:=gtk_object_get_data(PGtkObject(theDialog.Handle),
'LCLFilterMenu');
if FilterMenu<>nil then begin
@ -3192,6 +3192,9 @@ end;
{ =============================================================================
$Log$
Revision 1.207 2003/12/21 13:58:06 mattias
renamed DirectoryExists to DirPathExists to reduce ambigiousity
Revision 1.206 2003/11/26 21:30:19 mattias
reduced unit circles, fixed fpImage streaming

View File

@ -2489,7 +2489,7 @@ function TLazPackage.GetFileDialogInitialDir(const DefaultDirectory: string
begin
Result:=AppendPathDelim(TrimFilename(DefaultDirectory));
if (SourceDirectories.GetFileReference(Result)=nil)
and DirectoryExists(Directory) then
and DirPathExists(Directory) then
Result:=Directory;
end;

View File

@ -2170,7 +2170,7 @@ begin
{$ENDIF}
// check if package is ready for saving
OutputDir:=APackage.GetOutputDirectory;
if not DirectoryExists(OutputDir) then begin
if not DirPathExists(OutputDir) then begin
Result:=MessageDlg(lisEnvOptDlgDirectoryNotFound,
Format(lisPkgMangPackageHasNoValidOutputDirectory, ['"',
APackage.IDAsString, '"', #13, '"', OutputDir, '"']),