Wierd Issue with ExamineDirectory

Just starting out? Need help? Post your questions and find answers here.
User avatar
DarkRookie
User
User
Posts: 20
Joined: Wed Nov 24, 2010 5:47 pm

Wierd Issue with ExamineDirectory

Post by DarkRookie »

Whenever I use ExamineDirectory with an empty string in the DirectoryName$, it returns TRUE.

Is it suppose to do that?

The following debugs yes

Code: Select all

If ExamineDirectory(0, "", "*.*")
  Debug "Yes"
Else
  Debug "Nope"
EndIf
The following debugs Nope

Code: Select all

If ExamineDirectory(0, " ", "*.*")
  Debug "Yes"
Else
  Debug "Nope"
EndIf
It is better to have a dumb question than a wrong answer!
User avatar
Bisonte
Addict
Addict
Posts: 1305
Joined: Tue Oct 09, 2007 2:15 am

Re: Wierd Issue with ExamineDirectory

Post by Bisonte »

not wierd.... normal

If your Path is = "" - the current directory is used, but a directory named " " is not avaible....
PureBasic 6.21 (Windows x64) | Windows 11 Pro | AsRock B850 Steel Legend Wifi | R7 9800x3D | 64GB RAM | RTX 5080 | ThermaltakeView 270 TG ARGB | build by vannicom​​
English is not my native language... (I often use DeepL.)
User avatar
kenmo
Addict
Addict
Posts: 2033
Joined: Tue Dec 23, 2003 3:54 am

Re: Wierd Issue with ExamineDirectory

Post by kenmo »

An empty string used as a path (in PB and many other languages) usually refers to the current directory.

Code: Select all

Debug GetCurrentDirectory()
Debug ""

If ExamineDirectory(0, "", "")
  While NextDirectoryEntry(0)
    Debug GetCurrentDirectory() + DirectoryEntryName(0)
  Wend
  FinishDirectory(0)
EndIf
User avatar
DarkRookie
User
User
Posts: 20
Joined: Wed Nov 24, 2010 5:47 pm

Re: Wierd Issue with ExamineDirectory

Post by DarkRookie »

Ahh. OK. I did not know that empty string was current directory.
Thanks for the information and the quick response.
It is better to have a dumb question than a wrong answer!
Post Reply