Skip to content
Snippets Groups Projects
Commit 3c7d5d02 authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

ENH: rename config file to otb.conf, fix exception due to OTB_LANG instead of LANG in config file

parent 0b7a346e
No related branches found
No related tags found
No related merge requests found
......@@ -24,11 +24,11 @@ PURPOSE. See the above copyright notices for more information.
#include <iostream>
/**
* @brief main application for generating the otb_config.inp file.
*
* @param argv[1] Path to OTB_BINARY_DIR/otb_config.inp
* @brief main application for generating the otb.conf file.
*
* @param argv[2] language parameter
* @param argv[1] Path to OTB_BINARY_DIR/otb.conf
*
* @param argv[2] language parameter
*/
int main(int argc, char* argv[])
{
......@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
std::string releaseVersion = "0";
std::string::size_type pos1 = std::string::npos;
std::string::size_type pos2 = std::string::npos;
pos1 = versionNumber.find(".", 0);
if(pos1 != std::string::npos)
{
......@@ -104,17 +104,17 @@ int main(int argc, char* argv[])
<< std::endl;
*/
std::string language(argv[2]);
os << "#Auto generated by config-properties \n"
<< "#Language \n"
<< "OTB_LANG="
<< language
<< "\n"
<< "# end of config file properties generation"
<< std::endl;
<< std::endl;
os.close();
std::cout << "wrote file: " << argv[1] << std::endl;
exit(0);
......
......@@ -1127,14 +1127,14 @@ INCLUDE(CPack)
ENDIF(OTB_USE_CPACK)
FILE(GLOB otbconfigfileCreation_SRCS "${OTB_SOURCE_DIR}/CMake/generate-config-properties.cpp")
SET(otbconfigfile_DEFAULT "${OTB_BINARY_DIR}/otb_config.inp")
FILE(GLOB otbconfigfileCreation_SRCS "${OTB_SOURCE_DIR}/CMake/GenerateConfigProperties.cpp")
SET(otbconfigfile_DEFAULT "${OTB_BINARY_DIR}/otb.conf")
ADD_EXECUTABLE(generate-config-properties ${otbconfigfileCreation_SRCS})
ADD_EXECUTABLE(GenerateConfigProperties ${otbconfigfileCreation_SRCS})
ADD_CUSTOM_COMMAND(
TARGET generate-config-properties
TARGET GenerateConfigProperties
POST_BUILD
COMMAND generate-config-properties
COMMAND GenerateConfigProperties
ARGS "${otbconfigfile_DEFAULT}" "${OTB_LANG}"
COMMENT "Generating otb_config.inp" )
COMMENT "Generating ${otbconfigfile_DEFAULT}" )
......@@ -30,24 +30,24 @@ namespace otb
/** \class ConfigurationFile
* \brief Manage OTB ConfigurationFile file
*/
class ConfigurationFile
: public itk::Object
{
public:
/** Standard class typedef */
typedef ConfigurationFile Self;
typedef itk::Object Superclass;
typedef itk::SmartPointer<Self> Pointer;
typedef itk::SmartPointer<const Self> ConstPointer;
/** Standard macro */
itkTypeMacro(ConfigurationFile,Object);
/** This is protected for the singleton. Use GetInstance() instead. */
itkNewMacro(Self);
/** Get the unique instanc1e of the model */
// static Pointer GetInstance()
// {
......@@ -57,24 +57,25 @@ namespace otb
// }
// return Instance;
// };
ConfigFile * GetOTBConfig()
{
return m_OTBConfig;
};
std::string GetLanguage()
{
return m_OTBConfig->read<std::string>( "LANG" );
return m_OTBConfig->read<std::string>( "OTB_LANG" );
};
// std::string lib(OTB_CONFIG);
protected:
/** Constructor */
ConfigurationFile(){
ConfigurationFile()
{
std::string OTBBinDir(OTB_CONFIG);
m_OTBConfig = new ConfigFile(OTBBinDir + "/otb_config.inp");
m_OTBConfig = new ConfigFile(OTBBinDir + "/otb.conf");
}
;
/** Destructor */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment