Page 1 of 1

Wierd Issue with ExamineDirectory

Posted: Tue Jan 26, 2016 9:55 pm
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

Re: Wierd Issue with ExamineDirectory

Posted: Tue Jan 26, 2016 10:30 pm
by Bisonte
not wierd.... normal

If your Path is = "" - the current directory is used, but a directory named " " is not avaible....

Re: Wierd Issue with ExamineDirectory

Posted: Tue Jan 26, 2016 10:30 pm
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

Re: Wierd Issue with ExamineDirectory

Posted: Tue Jan 26, 2016 10:57 pm
by DarkRookie
Ahh. OK. I did not know that empty string was current directory.
Thanks for the information and the quick response.