HaikuPorts
  • Login
  • Preferences
  • Help/Guide
  • Wiki
  • Timeline
  • Roadmap
  • View Tickets
  • Search
  • Port Log
  • Blog

Context Navigation

  • Back to Ticket #468

Ticket #468: zaz-1.0.0.patch

File zaz-1.0.0.patch, 1.1 KB (added by michaelvoliveira, 5 years ago)

Path to replace DT_DIR use

  • src/directorylister.cpp

    diff -Naur zaz-1.0.0/src/directorylister.cpp zaz-1.0.0-haiku/src/directorylister.cpp
    old new  
    1919#include "directorylister.h" 
    2020#ifndef WIN32 
    2121 
     22#ifndef DT_DIR 
     23/* dirent.d_type is a BSD extension, not part of POSIX */ 
     24#include <dirent.h> 
    2225#include <sys/stat.h> 
     26#include <string.h> 
     27 
     28static int 
     29is_dir (const char *path, const char *name) 
     30{ 
     31  int len1 = strlen(path); 
     32  int len2 = strlen(name); 
     33 
     34  char pathname[len1 + 1 + len2 + 1 + 13]; 
     35  strcpy (pathname, path); 
     36 
     37  /* Avoid UNC-path "//name" on Cygwin.  */ 
     38  if (len1 > 0 && pathname[len1 - 1] != '/') 
     39    strcat (pathname, "/"); 
     40 
     41  strcat (pathname, name); 
     42 
     43  struct stat st; 
     44  if (stat (pathname, &st)) 
     45    return 0; 
     46  return S_ISDIR (st.st_mode); 
     47} 
     48#endif 
    2349 
    2450vector<string> ListFiles(string dir, const string extension) 
    2551{ 
    … …  
    3460    { 
    3561        bool isFile = false; 
    3662 
    37         if (file->d_type == DT_REG) 
     63        if (is_dir (dir.c_str(), file->d_name)) 
    3864            isFile = true; 
    3965 
    4066        if (!isFile) 

Download in other formats:

  • Original Format

Trac Powered

Powered by Trac 0.13dev-r10686
By Edgewall Software.

Visit the Trac open source project at
http://trac.edgewall.org/