Permalink
Browse files

fs, feat: support file access switch.

  • Loading branch information...
xicilion committed Aug 4, 2018
1 parent 6405bf7 commit e54cf2e52ebc324128315bbd2f87b11de25d65dd
Showing with 11 additions and 0 deletions.
  1. +2 −0 fibjs/include/Isolate.h
  2. +1 −0 fibjs/src/base/Runtime.cpp
  3. +8 −0 fibjs/src/fs/fs.cpp
View
@@ -139,6 +139,8 @@ class Isolate : public exlib::linkitem {
int32_t m_defaultMaxListeners;
int32_t m_exitCode;
bool m_bFileAccess;
};
} /* namespace fibjs */
@@ -262,6 +262,7 @@ Isolate::Isolate(exlib::string fname)
, m_loglevel(console_base::_NOTSET)
, m_defaultMaxListeners(10)
, m_exitCode(0)
, m_bFileAccess(true)
{
m_fname = fname;
View
@@ -246,6 +246,14 @@ result_t fs_base::openFile(exlib::string fname, exlib::string flags,
obj_ptr<File> pFile = new File();
result_t hr;
Isolate* isolate = ac->isolate();
if (isolate == NULL)
isolate = Isolate::current();
if (isolate && !isolate->m_bFileAccess)
return CHECK_ERROR(CALL_E_INVALID_CALL);
hr = pFile->open(safe_name, flags);
if (hr < 0)
return hr;

0 comments on commit e54cf2e

Please sign in to comment.