mirror of
https://github.com/clangen/musikcube.git
synced 2024-10-02 04:52:32 +00:00
Fixed fs::scanDirectory to be more reliable on *nix platforms with more uncommon filessytems (e.g. NFS on FreeBSD)
This commit is contained in:
parent
35edbe79b3
commit
a5dcf74588
@ -39,7 +39,7 @@ if [ $OS == "Darwin" ]; then
|
||||
fi
|
||||
if [ $OS == "FreeBSD" ]; then
|
||||
echo "detected freebsd"
|
||||
pkg install boost-all curl libvorbis libogg libmicrohttpd ffmpeg alsa-lib cmake sndio libev taglib bash libopenmpt
|
||||
pkg install boost-all ncurses curl libvorbis libogg libmicrohttpd ffmpeg alsa-lib cmake sndio libev taglib bash libopenmpt
|
||||
portsnap fetch
|
||||
portsnap extract
|
||||
cd /usr/ports/audio/lame
|
||||
|
@ -53,6 +53,7 @@
|
||||
#define DLLEXPORT
|
||||
#include <dirent.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
namespace musik { namespace core { namespace sdk { namespace fs {
|
||||
@ -182,7 +183,15 @@ namespace musik { namespace core { namespace sdk { namespace fs {
|
||||
if (interrupt && interrupt()) {
|
||||
return;
|
||||
}
|
||||
else if (entry->d_type == DT_DIR) {
|
||||
|
||||
bool hasTrailingSlash = path[path.size() - 1] == '/';
|
||||
std::string fn = path + (hasTrailingSlash ? "" : "/") + entry->d_name;
|
||||
|
||||
struct stat info = {0};
|
||||
if (stat(fn.c_str(), &info) < 0) {
|
||||
return;
|
||||
}
|
||||
if (S_ISDIR(info.st_mode)) {
|
||||
std::string name = entry->d_name;
|
||||
if (name == "." || name == "..") {
|
||||
continue;
|
||||
@ -190,9 +199,7 @@ namespace musik { namespace core { namespace sdk { namespace fs {
|
||||
scanDirectory(path + "/" + name, callback, interrupt);
|
||||
}
|
||||
else {
|
||||
std::string fn = entry->d_name;
|
||||
bool hasTrailingSlash = path[path.size() - 1] == '/';
|
||||
callback(path + (hasTrailingSlash ? "" : "/") + fn);
|
||||
callback(fn);
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,4 +207,4 @@ namespace musik { namespace core { namespace sdk { namespace fs {
|
||||
#endif
|
||||
}
|
||||
|
||||
} } } }
|
||||
} } } }
|
||||
|
Loading…
Reference in New Issue
Block a user