From 70a1e72428bfeb4bb54b242a64c402d2780d4b91 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Fri, 6 Mar 2015 21:00:30 +0100 Subject: [PATCH] Recognize files/dirs correctly --- CryNode.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CryNode.cpp b/CryNode.cpp index 0dfda4a7..a28c7d23 100644 --- a/CryNode.cpp +++ b/CryNode.cpp @@ -3,6 +3,8 @@ #include #include "CryDevice.h" +#include "CryDir.h" +#include "CryFile.h" #include "messmer/fspp/fuse/FuseErrnoException.h" namespace bf = boost::filesystem; @@ -20,7 +22,16 @@ CryNode::~CryNode() { } void CryNode::stat(struct ::stat *result) const { - result->st_mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IWUSR; + if (dynamic_cast(this) != nullptr) { + //printf("Stat: dir\n"); + result->st_mode = S_IFDIR; + } else if (dynamic_cast(this) != nullptr) { + //printf("Stat: file\n"); + result->st_mode = S_IFREG; + } else { + throw FuseErrnoException(EIO); + } + result->st_mode |= S_IRUSR | S_IXUSR | S_IWUSR; return; throw FuseErrnoException(ENOTSUP); }