Page MenuHomePhabricator (Chris)

No OneTemporary

Authored By
Unknown
Size
843 B
Referenced Files
None
Subscribers
None
diff --git a/util/system.cpp b/util/system.cpp
index c8864b34..07932258 100644
--- a/util/system.cpp
+++ b/util/system.cpp
@@ -1,6 +1,33 @@
#include <string>
#include "system.h"
+#ifndef WINDOWS
+#include <unistd.h>
+#include <sys/stat.h>
+#endif
+
+#ifndef WINDOWS
+static bool isReadable(const std::string & path){
+ if (access(path.c_str(), R_OK) == 0){
+ return true;
+ } else {
+ return false;
+ }
+}
+
+static bool isDirectory(const std::string & path){
+ struct stat info;
+ if (stat(path.c_str(), &info) == 0){
+ if (S_ISDIR(info.st_mode) == 1){
+ return true;
+ } else {
+ return false;
+ }
+ }
+ return false;
+}
+
bool System::readableFile(const std::string & path){
- return true;
+ return isReadable(path) && ! isDirectory(path);
}
+#endif

File Metadata

Mime Type
text/x-diff
Expires
Thu, Jun 11, 1:41 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
69294
Default Alt Text
(843 B)

Event Timeline