Commit f863dd07 authored by remicres's avatar remicres

ENH: Use temporary files prefix rather than a directory

parent 419399c4
......@@ -15,6 +15,9 @@
#include "lsrmBaatzSegmenter.h"
#include "lsgrmController.h"
// system tools
#include <itksys/SystemTools.hxx>
namespace otb
{
......@@ -94,6 +97,31 @@ private:
{
}
/*
* Return a prefix for temporary files
*/
std::string GetTemporaryFilesPrefix()
{
// Get output filename (without extension)
std::string outfname = GetParameterString("out");
std::string outbfname = itksys::SystemTools::GetFilenameWithoutExtension(outfname.c_str());
// Get specified temporary directory
std::string tmpdir = GetParameterAsString("tmpdir");
if (!tmpdir.empty())
{
// A temporary directory is specified: we check that it ends with a POSIX separator
if (tmpdir[tmpdir.size()-1] != '/')
{
// If not, we add the separator
tmpdir.append("/");
}
}
std::string prefix = tmpdir + outbfname;
return prefix;
}
void DoExecute()
{
/*
......@@ -113,7 +141,7 @@ private:
ControllerType controller;
controller.SetInputImage(inputImage);
controller.SetTemporaryDirectory(GetParameterAsString("tmpdir"));
controller.SetTemporaryFilesPrefix(this->GetTemporaryFilesPrefix());
// Tiling mode
int inputTilingMode = GetParameterInt("tiling");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment