Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

FindFile

 

class FindFile

This class serves as platform independent encapsulation of directory enumeration.

 

Public Method List

 

bool Search(const char *path)

Starts a new listing. path can contain wildcards ('*', '?') to list more than single file. Returns true if first file is found. Wildcard pattern follows Windows conventions, *.* matches all files, even those without extension.

 


 

bool Next()

Attemts to iterate to the next file, returns true if successful.

 


 

dword GetAttributes() const

[Win32]

Returns win32 attributes of file.

 


 

String GetName() const

Returns the name of current directory entry.

 


 

String GetPath() const

Returns the full path of current directory entry.

 


 

int64 GetLength() const

Returns the length of current file. Undefined if current directory entry is not file.

 


 

FileTime GetCreationTime() const

[Win32]

Returns Win32 creation time. Does not work with all filesystems.

 


 

FileTime GetLastAccessTime() const

Returns the last time the entry was accessed. Does not work with all filesystems.

 


 

FileTime GetLastWriteTime() const

Returns the last time the entry was modified. Always works.

 


 

uid_t GetUid()

[POSIX]

Returns user ID of file.

 


 

gid_t GetGid()

[POSIX]

Returns group ID of file.

 


 

bool CanRead() const

[POSIX]

Returns true if current user can read the file.

 


 

bool CanWrite() const

[POSIX]

Returns true if current user can write the file.

 


 

bool CanExecute() const

[POSIX]

Returns true if current user can execute the file.

 


 

FileTime GetLastChangeTime() const

[POSIX]

Returns the last change time (st_ctime member of stat structure).

 


 

bool IsDirectory() const

Returns true if entry is a directory. Note that FindFile returns '..' and '.' pseudo-directories in the listing (on both platforms), these return true as well.

 


 

bool IsFolder() const

Returns true if entry is a directory, but not '..' nor '.'.

 


 

bool IsFile() const

Returns true if entry is a file.

 


 

bool IsArchive() const

[Win32]

Returns true if entry has archive flag set.

 


 

bool IsCompressed() const

[Win32]

Returns true if entry has compressed flag set.

 


 

bool IsHidden() const

Returns true if entry has hidden flag set in Win32 or starts with '.' in POSIX.

 


 

bool IsReadOnly() const

Returns true if entry is read only (in current user context).

 


 

bool IsSystem() const

[Win32]

Returns true if entry has system flag set.

 


 

bool IsTemporary() const

[Win32]

Returns true if entry has system flag set.

 


 

bool IsSymLink() const

POSIX: Returns true if entry is POSIX symlink. Win32: Returns true if entry is Shell link file (.lnk with proper content).

 


 

bool IsExecutable() const

Returns true if target file is executable binary.

 


 

dword GetMode() const

[POSIX]

Returns UNIX access mode.

 


 

operator bool() const

Returns true if there is current entry in FindFile (if false, all entry information methods have undefined behaviour). Usually, this is used as condition to the loop that enumerates directory.

 

 

Constructor detail

 

FindFile()

Initializes to empty state.

 


 

FindFile(const char *name)

Initializes and performs Search(name).

 

 

Last edit by cxl on 12/02/2017. Do you want to contribute?. T++