From 93d096ed18422db46711c9b2f9098c9bea3cab46 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Wed, 2 Nov 2016 20:50:17 +0100 Subject: [PATCH] Fix create directory --- src/Utils/IO.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Utils/IO.cpp b/src/Utils/IO.cpp index 33e6a21c..e6685624 100644 --- a/src/Utils/IO.cpp +++ b/src/Utils/IO.cpp @@ -11,7 +11,11 @@ namespace Utils void WriteFile(std::string file, std::string data) { - CreateDirectory(file.substr(0, file.find_last_of("/\\"))); + auto pos = file.find_last_of("/\\"); + if (pos != std::string::npos) + { + CreateDirectory(file.substr(0, pos)); + } std::ofstream stream(file, std::ios::binary);