Index: src/FileSystemJsObject.cpp |
=================================================================== |
--- a/src/FileSystemJsObject.cpp |
+++ b/src/FileSystemJsObject.cpp |
@@ -20,17 +20,17 @@ namespace |
IoThread(JsEngine& jsEngine, JsValuePtr callback) |
: jsEngine(jsEngine), fileSystem(jsEngine.GetFileSystem()), |
callback(callback) |
{ |
} |
protected: |
JsEngine& jsEngine; |
- FileSystem& fileSystem; |
+ FileSystemPtr fileSystem; |
JsValuePtr callback; |
}; |
class ReadThread : public IoThread |
{ |
public: |
ReadThread(JsEngine& jsEngine, JsValuePtr callback, |
const std::string& path) |
@@ -39,17 +39,17 @@ namespace |
} |
void Run() |
{ |
std::string content; |
std::string error; |
try |
{ |
- std::tr1::shared_ptr<std::istream> stream = fileSystem.Read(path); |
+ std::tr1::shared_ptr<std::istream> stream = fileSystem->Read(path); |
content = Utils::Slurp(*stream); |
} |
catch (std::exception& e) |
{ |
error = e.what(); |
} |
catch (...) |
{ |
@@ -81,17 +81,17 @@ namespace |
void Run() |
{ |
std::string error; |
try |
{ |
std::tr1::shared_ptr<std::ostream> stream(new std::stringstream); |
*stream << content; |
- fileSystem.Write(path, stream); |
+ fileSystem->Write(path, stream); |
} |
catch (std::exception& e) |
{ |
error = e.what(); |
} |
catch (...) |
{ |
error = "Unknown error while writing to " + path; |
@@ -119,17 +119,17 @@ namespace |
{ |
} |
void Run() |
{ |
std::string error; |
try |
{ |
- fileSystem.Move(fromPath, toPath); |
+ fileSystem->Move(fromPath, toPath); |
} |
catch (std::exception& e) |
{ |
error = e.what(); |
} |
catch (...) |
{ |
error = "Unknown error while moving " + fromPath + " to " + toPath; |
@@ -157,17 +157,17 @@ namespace |
{ |
} |
void Run() |
{ |
std::string error; |
try |
{ |
- fileSystem.Remove(path); |
+ fileSystem->Remove(path); |
} |
catch (std::exception& e) |
{ |
error = e.what(); |
} |
catch (...) |
{ |
error = "Unknown error while removing " + path; |
@@ -195,17 +195,17 @@ namespace |
} |
void Run() |
{ |
std::string error; |
FileSystem::StatResult statResult; |
try |
{ |
- statResult = fileSystem.Stat(path); |
+ statResult = fileSystem->Stat(path); |
} |
catch (std::exception& e) |
{ |
error = e.what(); |
} |
catch (...) |
{ |
error = "Unknown error while calling stat on " + path; |