From: Thomas Geymayer Date: Mon, 28 Oct 2013 11:38:39 +0000 (+0100) Subject: HTTPFileRequest: create directory if it does not exist X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fdf6fc32ff12e57df40e23b31c32410da7ff13b7;p=simgear.git HTTPFileRequest: create directory if it does not exist --- diff --git a/simgear/io/HTTPFileRequest.cxx b/simgear/io/HTTPFileRequest.cxx index e5cc71d6..33b7339a 100644 --- a/simgear/io/HTTPFileRequest.cxx +++ b/simgear/io/HTTPFileRequest.cxx @@ -18,6 +18,7 @@ #include "HTTPFileRequest.hxx" #include +#include namespace simgear { @@ -38,9 +39,14 @@ namespace HTTP Request::responseHeadersComplete(); if( !_filename.empty() ) + { // TODO validate path? (would require to expose fgValidatePath somehow to // simgear) + SGPath path(_filename); + path.create_dir(0777); + _file.open(_filename.c_str(), std::ios::binary | std::ios::trunc); + } if( !_file ) {