From cf8371f30448d6ae5e7a2cdc0e564c5c1d5ae098 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Wed, 28 Feb 2018 15:32:16 -0500 Subject: [PATCH] Fix crash if screenshot folder already existed --- apps/OpenSpace/main.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/OpenSpace/main.cpp b/apps/OpenSpace/main.cpp index 260b3188f7..42100b12a4 100644 --- a/apps/OpenSpace/main.cpp +++ b/apps/OpenSpace/main.cpp @@ -321,7 +321,10 @@ void mainInitFunc() { strftime(mbstr, sizeof(mbstr), "%Y-%m-%d-%H-%M", nowTime); screenshotPath += "/" + std::string(mbstr); - FileSys.createDirectory(absPath(screenshotPath)); + std::string p = absPath(screenshotPath); + if (!FileSys.directoryExists(p)) { + FileSys.createDirectory(p); + } } for (size_t i = 0; i < nWindows; ++i) {