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












SourceForge.net Logo
Home » U++ Library support » U++ Core » I've been using FindFile wrong all these years
I've been using FindFile wrong all these years [message #49317] Thu, 25 January 2018 11:46 Go to previous message
cbpporter is currently offline  cbpporter
Messages: 1401
Registered: September 2007
Ultimate Contributor
While porting my applications to Linux I noticed a very strange bug: some files where missing when iterating over folders. After some investigation, it turns out that I've been using FindFile wrong since forever.

I kept wrting loops like this:
FindFile ff("");
while (ff.Next())
    DUMP(ff.GetPath());


This is wrong since it jump over the first file in the folder. On Windows this is not an issue since the first file is always ".." or ".", but under Linux I was missing real important files.

The correct way to write the loop is:
FindFile ff("");
while (ff) {
    DUMP(ff.GetPath());
    ff.Next();
}


Now I need to search for FindFile in all projects ever Smile.

Such a silly problem...


 
Read Message
Read Message
Read Message
Previous Topic: Question about SubRange.
Next Topic: Function.h: "expression cannot be used as a function"
Goto Forum:
  


Current Time: Sat Apr 27 10:17:19 CEST 2024

Total time taken to generate the page: 0.06222 seconds