]> Creatis software - bbtk.git/blob - packages/std/src/bbstdMakeFileName.cxx
e450d2cbd0f7e364571c14f93c78f7ea1a8a627a
[bbtk.git] / packages / std / src / bbstdMakeFileName.cxx
1 #include "bbstdMakeFileName.h"
2 #include "bbstdPackage.h"
3 #include "bbtkConfigurationFile.h"
4
5 namespace bbstd
6 {
7
8         BBTK_ADD_BLACK_BOX_TO_PACKAGE(std,MakeFileName)
9         BBTK_USER_BLACK_BOX_IMPLEMENTATION(MakeFileName,bbtk::AtomicBlackBox);
10
11         void MakeFileName::bbUserConstructor()
12    {
13       bbSetInputDirectory("");
14       bbSetInputFile("");
15       bbSetInputExtent("");
16    }
17
18         void MakeFileName::DoProcess()
19         {
20       std::string fileSep = bbtk::ConfigurationFile::GetInstance().Get_file_separator();
21       std::string fullFileName = bbGetInputDirectory();
22       if ( fullFileName.c_str()[fullFileName.size()-1] != '/' && fullFileName.c_str()[fullFileName.size()-1] != '\\' )
23          fullFileName += fileSep;
24       fullFileName += bbGetInputFile();
25       if ( bbGetInputExtent() != "")
26          if ( bbGetInputExtent()[0] != '.' )
27             fullFileName += ".";
28       fullFileName +=  bbGetInputExtent();
29       bbSetOutputOut( fullFileName );     
30         }
31 }
32 // EO namespace bbstd