From 75f763de6944a4ba27253ff67b432fbb60e7eacf Mon Sep 17 00:00:00 2001 From: Eduardo DAVILA Date: Sun, 12 Dec 2021 16:10:01 +0100 Subject: [PATCH] Clean code --- CMakeLists.txt | 2 +- kernel/src/bbtkConfigurationFile.cxx | 21 +++++++++++---------- kernel/src/bbtkUtilities.cxx | 8 ++++---- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9514401..cc43c39 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ - # --------------------------------------------------------------------- + # --------------------------------------------------------------------- # # Copyright (c) CREATIS (Centre de Recherche en Acquisition et Traitement de l'Image # pour la SantÈ) diff --git a/kernel/src/bbtkConfigurationFile.cxx b/kernel/src/bbtkConfigurationFile.cxx index 753e912..a103d45 100644 --- a/kernel/src/bbtkConfigurationFile.cxx +++ b/kernel/src/bbtkConfigurationFile.cxx @@ -378,12 +378,13 @@ namespace bbtk } sprintf(copyFile,"copy %s\\bbtk_config.xml.tmp \"%s\"\\bbtk_config.xml ",bbtk_path,rootDirectory ); + // EED 2021-12-12 -// WCHAR rootDirectory2[200]; -// MultiByteToWideChar( 0,0, rootDirectory, 200, rootDirectory2, 6); -// LPCWSTR rootDirectory3 = rootDirectory2; -// int attribs = GetFileAttributes (rootDirectory3); - int attribs = GetFileAttributes (rootDirectory); + WCHAR rootDirectory2[200]; + MultiByteToWideChar( 0,0, rootDirectory, 200, rootDirectory2, 6); + LPCWSTR rootDirectory3 = rootDirectory2; + int attribs = GetFileAttributes (rootDirectory3); +// int attribs = GetFileAttributes (rootDirectory); bbtkMessage("config",1,std::hex << attribs << " " << FILE_ATTRIBUTE_DIRECTORY << std::endl); @@ -392,11 +393,11 @@ namespace bbtk if ((attribs & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY ) /// \TODO : check ! { // EED 2021-12-12 -// WCHAR configPath2[200]; -// MultiByteToWideChar( 0,0, configPath, 200, configPath2, 6); -// LPCWSTR configPath3 = configPath2; -// if ( GetFileAttributes( configPath3 ) == 0xFFFFFFFF) - if ( GetFileAttributes( configPath ) == 0xFFFFFFFF) + WCHAR configPath2[200]; + MultiByteToWideChar( 0,0, configPath, 200, configPath2, 6); + LPCWSTR configPath3 = configPath2; + if ( GetFileAttributes( configPath3 ) == 0xFFFFFFFF) +// if ( GetFileAttributes( configPath ) == 0xFFFFFFFF) { system(copyFile); } diff --git a/kernel/src/bbtkUtilities.cxx b/kernel/src/bbtkUtilities.cxx index 85323d4..672dac6 100644 --- a/kernel/src/bbtkUtilities.cxx +++ b/kernel/src/bbtkUtilities.cxx @@ -672,10 +672,10 @@ void wtoc(const WCHAR* Source,CHAR* Dest) //2018-07-06 mingw64 //2021-12-12 -// wchar_t pname2[512]; -// long result = GetModuleFileName(NULL, pname2, pathsize); -// crea::System::wtoc(pname2,pname); - long result = GetModuleFileName(NULL, pname, pathsize); + wchar_t pname2[512]; + long result = GetModuleFileName(NULL, pname2, pathsize); + crea::System::wtoc(pname2,pname); +// long result = GetModuleFileName(NULL, pname, pathsize); if (result > 0) { /* fix up the dir slashes... */ -- 2.45.1