× General Purpose Components and Libraries, discussions, problems and suggestions

Question FindAllDirectories return wrong value?

  • Bronislav Miksha
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 2 months ago - 6 years 2 months ago #9444 by Bronislav Miksha
FindAllDirectories return wrong value? was created by Bronislav Miksha
Hello!
I have problem with obtaining a list of directories in directories begin with dot.

In Delphi TDirectory.GetDirectories('d:\test','*',TSearchOption(1)) return:

d:\test\.DotDir
d:\test\.DotDir\dir
d:\test\.DotDir\dir1
d:\test\.DotDir\dir1\dir2
d:\test\.DotDir\dir1\dir2\dir3

d:\test\Dir
d:\test\Dir\Dir4
d:\test\Dir\dir5

In Typon FindAllDirectories('d:\test',True); return:

d:\test\.DotDir
d:\test\Dir
d:\test\.DotDir\dir
d:\test\.DotDir\dir1
d:\test\Dir\Dir4
d:\test\Dir\dir5

Typhon 5.8 r52101 FPC 3.1.1 x86_64-win64-win32/win64
Last edit: 6 years 2 months ago by Bronislav Miksha.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
6 years 2 months ago #9445 by Sternas Stefanos
Replied by Sternas Stefanos on topic FindAllDirectories return wrong value?
Thanks Sir
Did you test Lab CT ver 5.8 Revision 005720 ?

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Bronislav Miksha
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 2 months ago #9450 by Bronislav Miksha
Replied by Bronislav Miksha on topic FindAllDirectories return wrong value?
Thanks for the support! Unfortunately it did not help. Attached my test project.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Offline
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
6 years 2 months ago #9451 by Sternas Stefanos
Replied by Sternas Stefanos on topic FindAllDirectories return wrong value?
Sir
we test your project
-pic1 Typhon32
-pic2 Typhon64

Windows 10 Pro 64bits

PilotLogic Architect and Core Programmer

Please Log in or Create an account to join the conversation.

  • Bronislav Miksha
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 2 months ago #9453 by Bronislav Miksha
Replied by Bronislav Miksha on topic FindAllDirectories return wrong value?
Thanks for the support! I think found the reason. I copied the folders from a Linux system. And there is a folder beginning with a dot are considered hidden mark. If you set the flag "Hidden" is a problem. I recorded a little video with this problem.

Please Log in or Create an account to join the conversation.

  • Bronislav Miksha
  • Topic Author
  • Offline
  • New Member
  • New Member
More
6 years 1 month ago #9531 by Bronislav Miksha
Replied by Bronislav Miksha on topic FindAllDirectories return wrong value?
Hello sir!
My solution in analogy with findallfiles:
In fileutil.pas edit
function FindAllDirectories(const SearchPath: string;
  SearchSubDirs: Boolean = True; DirAttr:DWord = faDirectory): TStringList; overload;
procedure FindAllDirectories(AList: TStrings; const SearchPath: String;
  SearchSubDirs: Boolean = True ; DirAttr:DWord = faDirectory); overload;
In fileutil.inc after
Searcher := TListDirectoriesSearcher.Create(AList);
add
Searcher.DirectoryAttribute := DirAttr;

example
DirectoriesList:=FindAllDirectories(TestDir,True,(faDirectory or faHidden));

Could you check out this solution and if it is valid to add it by default in fileutil?

Please Log in or Create an account to join the conversation.