Fix build on Solaris
d_type is not part of the POSIX spec unfortunately.
This commit is contained in:
@@ -232,7 +232,11 @@ DirEntries readDirectory(const Path & path)
|
||||
checkInterrupt();
|
||||
string name = dirent->d_name;
|
||||
if (name == "." || name == "..") continue;
|
||||
#ifdef HAVE_STRUCT_DIRENT_D_TYPE
|
||||
entries.emplace_back(name, dirent->d_ino, dirent->d_type);
|
||||
#else
|
||||
entries.emplace_back(name, dirent->d_ino, getFileType(absPath(name, path)));
|
||||
#endif
|
||||
}
|
||||
if (errno) throw SysError(format("reading directory ‘%1%’") % path);
|
||||
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
#ifndef HAVE_STRUCT_DIRENT_D_TYPE
|
||||
#define DT_UNKNOWN 0
|
||||
#define DT_REG 1
|
||||
#define DT_LNK 2
|
||||
#define DT_DIR 3
|
||||
#endif
|
||||
|
||||
namespace nix {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user