Convert _filename to an SGPath
This commit is contained in:
@@ -41,14 +41,13 @@ namespace HTTP
|
||||
if( responseCode() != 200 )
|
||||
return setFailure(responseCode(), responseReason());
|
||||
|
||||
if( !_filename.empty() )
|
||||
if( !_filename.isNull() )
|
||||
{
|
||||
// TODO validate path? (would require to expose fgValidatePath somehow to
|
||||
// simgear)
|
||||
SGPath path(_filename);
|
||||
path.create_dir(0755);
|
||||
_filename.create_dir(0755);
|
||||
|
||||
_file.open(_filename.c_str(), std::ios::binary | std::ios::trunc);
|
||||
_file.open(_filename.c_str(), std::ios::binary | std::ios::trunc | std::ios::out);
|
||||
}
|
||||
|
||||
if( !_file )
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifndef SG_HTTP_FILEREQUEST_HXX_
|
||||
#define SG_HTTP_FILEREQUEST_HXX_
|
||||
|
||||
#include <simgear/misc/sg_path.hxx>
|
||||
#include "HTTPRequest.hxx"
|
||||
#include <fstream>
|
||||
|
||||
@@ -43,7 +44,7 @@ namespace HTTP
|
||||
FileRequest(const std::string& url, const std::string& path);
|
||||
|
||||
protected:
|
||||
std::string _filename;
|
||||
SGPath _filename;
|
||||
std::ofstream _file;
|
||||
|
||||
virtual void responseHeadersComplete();
|
||||
|
||||
Reference in New Issue
Block a user