|
|
|
@ -27,7 +27,7 @@ bool MakePath(const MString& dname)
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
RetVal<std::vector<struct FileInfo>> ReadLocalFileList(const MString& dir, const MString& path) |
|
|
|
|
RetVal<std::vector<struct FileInfo>> ReadLocalFileList(const MString& dir, const bool nofollow, const MString& path) |
|
|
|
|
{ |
|
|
|
|
const static MString pref = "ReadLocalFileList"; |
|
|
|
|
|
|
|
|
@ -48,11 +48,11 @@ RetVal<std::vector<struct FileInfo>> ReadLocalFileList(const MString& dir, const
|
|
|
|
|
do { |
|
|
|
|
if(dent->d_name[0] != '.') |
|
|
|
|
{ |
|
|
|
|
int ret = fstatat(dfd, dent->d_name, &st, AT_SYMLINK_NOFOLLOW); |
|
|
|
|
int ret = fstatat(dfd, dent->d_name, &st, nofollow ? AT_SYMLINK_NOFOLLOW : 0); |
|
|
|
|
if(ret != 0) return {pref, "Can't stat " + path + "/" + dir + "/" + dent->d_name}; |
|
|
|
|
if(S_ISDIR(st.st_mode)) // Directory, recurse
|
|
|
|
|
{ |
|
|
|
|
auto list = ReadLocalFileList(dir + "/" + dent->d_name, path + (path.Exist() ? "/" : "") + dent->d_name); |
|
|
|
|
auto list = ReadLocalFileList(dir + "/" + dent->d_name, nofollow, path + (path.Exist() ? "/" : "") + dent->d_name); |
|
|
|
|
if(!list) return list; |
|
|
|
|
out.insert(out.end(), list.Value().begin(), list.Value().end()); |
|
|
|
|
} |
|
|
|
|