Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Register now
TDirectory.GetDirectories returns files too
## Summary TDirectory.GetDirectories returns all files and folders inside the specified path. ## System Information <!-- The more information are provided the easier it is to replicate the bug --> - **Operating system:** Alt.Linux 10.4 - **Processor architecture:** x86-64 - **Compiler version:** trunk (2b6c136d) - **Device:** Computer ## Example Project Please, take a look to attached sample project: [test2.zip](/uploads/3bccd79fc25c71d66d7b2b8201e26081/test2.zip) ## What is the current bug behavior? TDirectory.GetDirectories returns all files and folders inside the specified path. ## What is the expected (correct) behavior? TDirectory.GetDirectories returns directories only ## Possible fixes In current code, the TDirectory uses a faDirectory to filter the content, but (according the documentation: https://www.freepascal.org/docs-html/rtl/sysutils/findfirst.html - specifying faDirectory as a value for Attr does not mean that only directories will be returned. Normal files and directories will be returned), it will not filter the files. In Delphi, TDirectory uses internal predicate to filter the directory/files in this case. So, I has implemented similar solution: [IOUtils.patch](/uploads/135fc7829e8335d2409fe2e9a5587edd/IOUtils.patch)
issue