From fdf6fc32ff12e57df40e23b31c32410da7ff13b7 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Mon, 28 Oct 2013 12:38:39 +0100 Subject: [PATCH] HTTPFileRequest: create directory if it does not exist --- simgear/io/HTTPFileRequest.cxx | 6 ++++++ 1 file changed, 6 insertions(+) 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 ) { -- 2.39.5