Welcome, Guest. Please Login
YaBB - Yet another Bulletin Board
 
  HomeHelpSearchLogin  
 
Pages: 1 2 
compilation (Read 9998 times)
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: compilation
Reply #15 - Oct 14th, 2005 at 11:04am
 
Dear Konrad,

Here's a fix of the ScanDirectory... function which does not rely on d_type and uses a more portable [tt]stat[/tt] instead.

I'll roll this fix into the next build. Thanks for pointing this out: UNIX portability issues should be dealt with whenever possible! This will teach me a lesson about assuming that if something runs on OS X, RedHat and AIX (three UNIX distros I have access to) then it runs everywhere else :)

[code]
//__________________________________________________________________________________
char      ScanDirectoryForFileNames (_String& source, _List& rec, bool recurse)
{
     DIR * dirPntr = opendir (source.sData);
     if (dirPntr)
     /* source directory exists */
     {
           struct dirent * curEntry = nil;
                 
           while (curEntry = readdir (dirPntr))
           // index thru the items
           {
                 _String childDir (curEntry->d_name);
                 if (childDir[0] != '.') // invisible file
                 {
                       childDir = source & '/' & childDir;            
                       struct stat      fileInfo;
                       if (stat(childDir.sData, &fileInfo) == 0)
                       //if (curEntry->d_type == DT_DIR)
                       {
                             if (S_ISDIR(fileInfo.st_mode))
                             // a directory
                             {
                                   if (recurse)
                                         ScanDirectoryForFileNames (childDir,rec,true);
                             }
                             else
                                   //if (curEntry->d_type == DT_REG)
                                   if (S_ISREG(fileInfo.st_mode))
                                         rec && & childDir;
                       }
                 }
           }
           closedir (dirPntr);
     }
     return '/';
}
[/code]

Cheers,
Sergei
Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged
 
konrad
Junior Member
**
Offline


I love YaBB 1G - SP1!

Posts: 53
Re: compilation
Reply #16 - Oct 17th, 2005 at 3:54am
 
Great, everything is working now. In case anyone else is following this, you also need to put #include <sys/stat.h>
in the file header.

Sorry about the silly mistake with the if scope, but at least it uncovered the color depth issue - setting my color depth to 24 did the trick.

Thanks a lot for all the effort,
Konrad
Back to top
 
WWW WWW  
IP Logged
 
Sergei
YaBB Administrator
*****
Offline


Datamonkeys are forever...

Posts: 1658
UCSD
Gender: male
Re: compilation
Reply #17 - Oct 17th, 2005 at 7:41am
 
Dear Konrad,

I am glad this is working for you now.

Please let me know if you have any further issues.

Cheers,
Sergei
Back to top
 

Associate Professor
Division of Infectious Diseases
Division of Biomedical Informatics
School of Medicine
University of California San Diego
WWW WWW  
IP Logged
 
Pages: 1 2