Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2003-08

dirsel.pas

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bob Wingard
to Bob Wingard
Vincent Snijders wrote 8 lines
Hi, Nice progress! I have a few remarks/questions: - The second FindFirst (used to look for subdirectories) in FindMatchingTextFiles needs a matching findclose.

Good eye, fixed.

Show quoted text 6 lines
- In TLazFindInFilesDialog.DirectoryBrowseClick you use if then to append the path delimeter. You can use PathDelim from SusUtils unit or DirectorySeparator from the system unit (both part of fpc RTL). You might look also to AppendPathDelim in the FileCtrl unit (part of the LCL).

Again, you are correct. There is another decleration of AppendPathDelim off in the Codetools directory and that is the one that I originally saw. fixed.

Show quoted text 6 lines
- Why do you use SysUtils.FindFirst(TempDir+FindMask,faAnyFile,FileInfo) and not SysUtils.FindFirst(TempDir+FindMask,faDirectory,FileInfo) when you are looking for (sub)directories?

This works on Windows but will not return any files on Linux. I am not sure but I think it is because everything is a file under linux, so directories are files with the directory attribute set.

Show quoted text 5 lines
Regards, Vincent Snijders.

<snip>
Bob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: zip00021.zip
Type: application/octet-stream
Size: 1238 bytes
Desc: "dirsel.zip"
Url : http://localhost/pipermail/lazarus/attachments/20030802/46a4e190/zip00021.obj

Reply by email

Mattias Gaertner
to Bob Wingard: Corrects a problem where directories that are not selected show that they are. Sorts…
Show quoted text 11 lines
Vincent Snijders wrote: >Hi, > >Nice progress! > >I have a few remarks/questions: >- The second FindFirst (used to look for subdirectories) in >FindMatchingTextFiles needs a matching findclose. > Good eye, fixed.

I tried to apply and got:

patching file findinfilesdlg.pas
patching file ideprocs.pp
patch: **** malformed patch at line 71: Index: lcl/dirsel.pas

The patch seems to be ok. Does someone know, what this means?

Mattias

Show quoted text 29 lines
>- In TLazFindInFilesDialog.DirectoryBrowseClick you use if then >to append the path delimeter. You can use PathDelim from SusUtils unit >or DirectorySeparator from the system unit (both part of fpc RTL). You >might look also to AppendPathDelim in the FileCtrl unit (part of the >LCL). > Again, you are correct. There is another decleration of AppendPathDelim off in the Codetools directory and that is the one that I originally saw. fixed. >- Why do you use >SysUtils.FindFirst(TempDir+FindMask,faAnyFile,FileInfo) >and not >SysUtils.FindFirst(TempDir+FindMask,faDirectory,FileInfo) >when you are looking for (sub)directories? > This works on Windows but will not return any files on Linux. I am not sure but I think it is because everything is a file under linux, so directories are files with the directory attribute set. > >Regards, >Vincent Snijders. > > <snip> Bob

Reply by email

Bob Wingard
to Bob Wingard: Corrects a problem where directories that are not selected show that they are. Sorts…
Mattias Gaertner wrote 80 lines
On Sat, 02 Aug 2003 10:04:24 -0400 Bob Wingard wrote: >Vincent Snijders wrote: > > > >>Hi, >> >>Nice progress! >> >>I have a few remarks/questions: >>- The second FindFirst (used to look for subdirectories) in >>FindMatchingTextFiles needs a matching findclose. >> >> >> >Good eye, fixed. > > I tried to apply and got: patching file findinfilesdlg.pas patching file ideprocs.pp patch: **** malformed patch at line 71: Index: lcl/dirsel.pas The patch seems to be ok. Does someone know, what this means? Mattias >>- In TLazFindInFilesDialog.DirectoryBrowseClick you use if then >>to append the path delimeter. You can use PathDelim from SusUtils unit >>or DirectorySeparator from the system unit (both part of fpc RTL). You >>might look also to AppendPathDelim in the FileCtrl unit (part of the >>LCL). >> >> >> >Again, you are correct. There is another decleration of AppendPathDelim >off in the Codetools directory and that is the one that I originally >saw. fixed. > > > >>- Why do you use >>SysUtils.FindFirst(TempDir+FindMask,faAnyFile,FileInfo) >>and not >>SysUtils.FindFirst(TempDir+FindMask,faDirectory,FileInfo) >>when you are looking for (sub)directories? >> >> >> >This works on Windows but will not return any files on Linux. I am not >sure but I think it is because everything is a file under linux, so >directories are files with the directory attribute set. > > > >>Regards, >>Vincent Snijders. >> >> >> >> ><snip> >Bob > > >

Could have been somthing I did. Try this one.

Index: findinfilesdlg.pas
=================================================================== RCS file: /FPC/CVS/projects/lazarus/findinfilesdlg.pas,v retrieving revision 1.6
diff -u -r1.6 findinfilesdlg.pas
--- findinfilesdlg.pas 1 Aug 2003 09:44:51 -0000 1.6 +++ findinfilesdlg.pas 2 Aug 2003 16:35:44 -0000
@@ -62,6 +62,9 @@

 implementation

+uses
+ filectrl;
+
{ TLazFindInFilesDialog }

 constructor TLazFindInFilesDialog.Create(AOwner: TComponent);
@@ -340,10 +343,7 @@
 begin
   TheDirectory:= GetCurrentDir;
   TheRootDir:= ExtractFileDrive(TheDirectory);
-  if Length(TheRootDir)< 1 then
-    TheRootDir:= '/'   //Linux or Unix ?
-  else
-    TheRootDir:= TheRootDir + '\';
+  TheRootDir:= FileCtrl.AppendPathDelim(TheRootDir);
   if SelectDirectory('Select A Directory', TheRootDir, TheDirectory, false) then
      DirectoryComboBox.Text:= TheDirectory;

Index: ideprocs.pp
=================================================================== RCS file: /FPC/CVS/projects/lazarus/ideprocs.pp,v
retrieving revision 1.89
diff -u -r1.89 ideprocs.pp
--- ideprocs.pp 1 Aug 2003 09:44:51 -0000 1.89
+++ ideprocs.pp 2 Aug 2003 16:35:45 -0000
@@ -2100,19 +2100,23 @@

       MaskList.Free;
     end;//try-finally
     //If selected then Look for and search subdirectories

- if (recursive) and (SysUtils.FindFirst(TempDir
- +FindMask,faAnyFile,FileInfo)=0) then
- begin
- if ((faDirectory and FileInfo.Attr)>0) then
+ try
+ if (recursive) and (SysUtils.FindFirst(TempDir
+ +FindMask,faAnyFile,FileInfo)=0) then

       begin

- repeat
- // check if special file
- if (FileInfo.Name='.') or (FileInfo.Name='..') then continue;
- FindMatchingTextFiles
- (FileList,TempDir + FileInfo.Name,mask,recursive);
- until SysUtils.FindNext(FileInfo)0;
+ if ((faDirectory and FileInfo.Attr)>0) then
+ begin
+ repeat
+ // check if special file
+ if (FileInfo.Name='.') or (FileInfo.Name='..') then continue;
+ FindMatchingTextFiles
+ (FileList,TempDir + FileInfo.Name,mask,recursive);
+ until SysUtils.FindNext(FileInfo)0;
+ end;//if

       end;//if

- end;//if
+ finally
+ SysUtils.FindClose(FileInfo);
+ end;//try-finally

   end;//if

end;//FindMatchingFiles

Index: lcl/dirsel.pas
===================================================================
RCS file: /FPC/CVS/projects/lazarus/lcl/dirsel.pas,v
retrieving revision 1.2
diff -u -r1.2 dirsel.pas
--- lcl/dirsel.pas	2 Aug 2003 01:07:39 -0000	1.2
+++ lcl/dirsel.pas	2 Aug 2003 16:35:45 -0000
@@ -90,13 +90,12 @@
  Result:= False;
  if Dir  '' then
  begin
+   FCurrentDir:= Dir;
+   FileCtrl.AppendPathDelim(FCurrentDir);
    i:= length(Dir);
-   if Dir[i] = PathDelim then
-     FCurrentDir:= Dir + FindMask
-   else
-     FCurrentDir:= Dir + PathDelim + FindMask;
+   FCurrentDir:= Dir + FindMask;
    Try
-     if SysUtils.FindFirst(FCurrentDir, faAnyFile,FileInfo)=0 then
+     if SysUtils.FindFirst(FCurrentDir, (faAnyFile),FileInfo)=0 then
      begin
        repeat
          // check if special file
@@ -127,11 +126,10 @@
 begin
   if Dir  '' then
   begin
-    i:= length(Dir);
-    if Dir[i] = PathDelim then
-      FCurrentDir:= Dir + FindMask
-    else
-      FCurrentDir:= Dir + PathDelim + FindMask;
+    FCurrentDir:= Dir;
+    FileCtrl.AppendPathDelim(FCurrentDir);
+    i:= length(FCurrentDir);
+    FCurrentDir:= Dir + FindMask;
     Try
       if SysUtils.FindFirst(FCurrentDir, faAnyFile,FileInfo)=0 then
       begin

Reply by email

Vincent Snijders
to Bob Wingard: Corrects a problem where directories that are not selected show that they are. Sorts…

Hi,

Nice progress!

I have a few remarks/questions:
- The second FindFirst (used to look for subdirectories) in FindMatchingTextFiles needs a matching findclose.
- In TLazFindInFilesDialog.DirectoryBrowseClick you use if then to append the path delimeter. You can use PathDelim from SusUtils unit or DirectorySeparator from the system unit (both part of fpc RTL). You might look also to AppendPathDelim in the FileCtrl unit (part of the LCL).
- Why do you use
SysUtils.FindFirst(TempDir+FindMask,faAnyFile,FileInfo) and not
SysUtils.FindFirst(TempDir+FindMask,faDirectory,FileInfo) when you are looking for (sub)directories?

Regards,
Vincent Snijders.

Show quoted text 9 lines
Corrects a problem where directories that are not selected show that they are. Sorts directories. I just updated CVS on my laptop, looks like the windows version is running! Bob

Reply by email