Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: FindFirst(), FindNext() cannot detect sub directory name ? ( RESOLVED )


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: Jun 25, 2014 11:24 AM Last Post By: bernard roussely
GAI CHEW KAI

Posts: 53
Registered: 7/29/04
FindFirst(), FindNext() cannot detect sub directory name ? ( RESOLVED )  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 6, 2014 6:59 PM
I referred to the link below:

http://docwiki.embarcadero.com/CodeExamples/XE4/en/FindFirst_(C%2B%2B)

...and noticed the sub directory is not being detected and stored into TSearchRec.

eg.

Target directory to scan is /storage/sdcard1/demo, and there is a folder named "confidential" under /demo such as /storage/sdcard1/demo/confidential which is not being reported into TSearchRec.

However, both "." and ".." can be detected normally.

Please advise.

GAI CHEW KAI

Posts: 53
Registered: 7/29/04
Re: FindFirst(), FindNext() cannot detect sub directory name ? ( RESOLVED )  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 9, 2014 1:29 AM   in response to: GAI CHEW KAI in response to: GAI CHEW KAI
...just found out the mistake.

In Android, instead of using:

FindFirst( "\storage\demo\readonly\*.*", ... )

The correct statement should be:

FindFirst( "\storage\demo\readonly\*", ... )

Sometime, I need to think like Linux way instead of Windows practice.
bernard roussely

Posts: 106
Registered: 2/8/05
Re: FindFirst(), FindNext() cannot detect sub directory name ? ( RESOLVED )  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jun 25, 2014 7:57 AM   in response to: GAI CHEW KAI in response to: GAI CHEW KAI
In Android, instead of using:

FindFirst( "\storage\demo\readonly\*.*", ... )

The correct statement should be:

FindFirst( "/storage/demo/readonly/*", faAnyFile, sr)

and then

if((sr.Attr & faDirectory) == faDirectory) {
// do whatever is required, with sr being a TSearchRec
}

bernard
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02