summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ShellUtils.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/shell/ShellUtils.cpp b/shell/ShellUtils.cpp
index 80ddb341bb3..c7fbba6679d 100644
--- a/shell/ShellUtils.cpp
+++ b/shell/ShellUtils.cpp
@@ -3,6 +3,7 @@
#include "ShellUtils.h"
#include <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
+#include <boost/filesystem/operations.hpp>
#include <iostream>
using namespace std;
@@ -101,6 +102,13 @@ v8::Handle<v8::Value> Version(const v8::Arguments& args) {
}
v8::Handle<v8::String> ReadFile(const char* name) {
+
+ boost::filesystem::path p(name);
+ if ( is_directory( p ) ){
+ cerr << "can't read directory [" << name << "]" << endl;
+ return v8::String::New( "" );
+ }
+
FILE* file = fopen(name, "rb");
if (file == NULL) return v8::Handle<v8::String>();