From 971125756011ca6410e2a79de7001793d49cd72e Mon Sep 17 00:00:00 2001 From: Manuel Grizonnet <manuel.grizonnet@gmail.com> Date: Thu, 15 Oct 2009 14:38:54 +0200 Subject: [PATCH] ENH:Get locale conf with std::locale --- CMake/GenerateConfigProperties.cpp | 14 +++++++++----- CMakeLists.txt | 2 +- Testing/Code/Common/otbConfigurationTest.cxx | 5 ++++- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CMake/GenerateConfigProperties.cpp b/CMake/GenerateConfigProperties.cpp index 4f60a4ffb1..bd08948e8f 100644 --- a/CMake/GenerateConfigProperties.cpp +++ b/CMake/GenerateConfigProperties.cpp @@ -33,7 +33,7 @@ PURPOSE. See the above copyright notices for more information. */ int main(int argc, char* argv[]) { - const unsigned int nbParameters = 3; + const unsigned int nbParameters = 2; std::ofstream os(argv[1]); if (!os) @@ -57,22 +57,26 @@ int main(int argc, char* argv[]) paramVector.push_back(""); } } + + /** Get local configuration*/ + const std::locale& mylocale = std::locale(""); + /** Write parameters to the configuration file*/ os << "#Auto generated by config-properties \n" << "OTB_LANG=" - << paramVector[0] + << mylocale.name() << "\n" << "OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING=" - << paramVector[1] + << paramVector[0] << "\n" << "OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING=" - << paramVector[2] + << paramVector[1] << "\n" << "#End of config file properties generation" << std::endl; os.close(); - + std::cout << "wrote file: " << argv[1] << std::endl; exit(0); diff --git a/CMakeLists.txt b/CMakeLists.txt index 265aa8e3ea..6633a2a158 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1136,5 +1136,5 @@ ADD_CUSTOM_COMMAND( TARGET GenerateConfigProperties POST_BUILD COMMAND GenerateConfigProperties - ARGS "${otbconfigfile_DEFAULT}" "${OTB_LANG}" "${OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING}" "${OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING}" + ARGS "${otbconfigfile_DEFAULT}" "${OTB_STREAM_IMAGE_SIZE_TO_ACTIVATE_STREAMING}" "${OTB_STREAM_MAX_SIZE_BUFFER_FOR_STREAMING}" COMMENT "Generating ${otbconfigfile_DEFAULT}" ) diff --git a/Testing/Code/Common/otbConfigurationTest.cxx b/Testing/Code/Common/otbConfigurationTest.cxx index 5ddcf80a50..62dcc47e07 100644 --- a/Testing/Code/Common/otbConfigurationTest.cxx +++ b/Testing/Code/Common/otbConfigurationTest.cxx @@ -34,7 +34,10 @@ int otbConfigurationTest(int argc, char * argv[]) std::cout << conf << std::endl; if (lang != "fr_FR.UTF-8") - return EXIT_FAILURE; + { + std::cout << "Locale language " << lang << std::endl; + return EXIT_FAILURE; + } return EXIT_SUCCESS; } -- GitLab