summaryrefslogtreecommitdiff
path: root/hscript
diff options
context:
space:
mode:
Diffstat (limited to 'hscript')
-rw-r--r--hscript/script.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/hscript/script.cc b/hscript/script.cc
index 0e7e00d..f1f36b8 100644
--- a/hscript/script.cc
+++ b/hscript/script.cc
@@ -883,8 +883,12 @@ bool Script::execute() const {
bool success;
boost::system::error_code ec;
- if(!fs::exists("/tmp/horizon", ec) &&
- !fs::create_directory("/tmp/horizon", ec)) {
+ /* assume create_directory will give us the error if removal fails */
+ if(fs::exists("/tmp/horizon", ec)) {
+ fs::remove_all("/tmp/horizon", ec);
+ }
+
+ if(!fs::create_directory("/tmp/horizon", ec)) {
output_error("internal", "could not create temporary directory",
ec.message());
return false;