Skip to content

Commit

Permalink
Added way to delete files + 30 lines of history log for JS
Browse files Browse the repository at this point in the history
  • Loading branch information
Daivuk committed Jun 10, 2018
1 parent 6e03943 commit 69550d9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/JSBindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10070,6 +10070,23 @@ namespace onut
}
JS_INTERFACE_END("Http");

// FileSystem
JS_INTERFACE_BEGIN();
{
JS_INTERFACE_FUNCTION_BEGIN
{
auto filename = JS_STRING(0);
auto foundFilename = oContentManager->findResourceFile(filename);
if (foundFilename.empty()) return DUK_RET_URI_ERROR;

remove(foundFilename.c_str());

return 0;
}
JS_INTERFACE_FUNCTION_END("delete", 1);
}
JS_INTERFACE_END("FileSystem");

// Crypto
JS_INTERFACE_BEGIN();
{
Expand Down
2 changes: 1 addition & 1 deletion src/Log.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace onut
auto split = onut::splitString(message, '\n');
s_onScreenLogMutex.lock();
for (const auto& line : split) s_logHistory.push_back(line);
while (s_logHistory.size() > 10) s_logHistory.erase(s_logHistory.begin());
while (s_logHistory.size() > 30) s_logHistory.erase(s_logHistory.begin());
s_onScreenLogMutex.unlock();
}
}
Expand Down

0 comments on commit 69550d9

Please sign in to comment.