]> Creatis software - bbtk.git/blobdiff - kernel/src/bbtkUtilities.cxx
#3203 BBTK Feature New Normal vtk7itk4wx3-mingw64
[bbtk.git] / kernel / src / bbtkUtilities.cxx
index a7285fed13e6e80efd8b93cdba1d9e3747f26acb..4bf1689be6aed0a62dee70aa01cc4db48b078df3 100644 (file)
@@ -621,6 +621,7 @@ namespace bbtk
   //
   int get_app_path (char *pname, size_t pathsize)
   {
+
 #ifdef LINUX
     /* Oddly, the readlink(2) man page says no NULL is appended. */
     /* So you have to do it yourself, based on the return value: */
@@ -638,10 +639,11 @@ namespace bbtk
 #endif /* LINUX */
     
 #ifdef WIN32
+
 //2018-07-06 mingw64
     wchar_t pname2[512];
-       mbstowcs(pname2,pname,strlen(pname)+1);
     long result = GetModuleFileName(NULL, pname2, pathsize);
+//     int ret = wcstombs ( pname, pname2, sizeof(pname) );    
 //    long result = GetModuleFileName(NULL, pname, pathsize);
     if (result > 0)
       {
@@ -740,6 +742,8 @@ namespace bbtk
     free (given_path);
     return status;
 #endif /* MACOSX */
+
+printf("EED Utilities   get_app_path END\n");
     
     return -1; /* Path Lookup Failed */
   } 
@@ -750,20 +754,59 @@ namespace bbtk
   //=========================================================================
   std::string Utilities::GetExecutablePath()
   {
+printf("EED Utilities::GetExecutablePath Start\n");
     char name[PATH_MAX];
+printf("EED Utilities::GetExecutablePath 1 \n");
     int err = get_app_path(name, PATH_MAX);
+printf("EED Utilities::GetExecutablePath 2 \n");
     if (err) 
       {
-       bbtkGlobalError("Could not determine current executable path ?");  
+printf("EED Utilities::GetExecutablePath 2.1 \n");
+//     bbtkGlobalError("Could not determine current executable path ?");  
+
+/*
+
+printf("EED Utilities  bbtkGlobalError  XX Start\n");  
+  do                                                   
+    {                                                  
+printf("EED Utilities  bbtkGlobalError XX A.1\n");     
+      std::ostringstream s;                            
+printf("EED Utilities  bbtkGlobalError XX A.2\n");     
+      s << "Could not determine current executable path ?";                                    
+printf("EED Utilities  bbtkGlobalError XX A.3\n");     
+      std::ostringstream f;                            
+printf("EED Utilities  bbtkGlobalError XX A.4\n");     
+      f << __FILE__ << " (l."<<__LINE__<<")";          
+printf("EED Utilities  bbtkGlobalError XX A.5\n");     
+std::string aa=f.str();
+printf("EED Utilities  bbtkGlobalError XX A.6\n");     
+std::string bb=f.str();
+printf("EED Utilities  bbtkGlobalError XX A.7\n");     
+      bbtk::Exception e( "global scope",               
+                       f.str(),                        
+                       s.str());                       
+      throw e;                                         
+printf("EED Utilities  bbtkGlobalError XX B\n");       
+    }                                                  
+  while (0); 
+printf("EED Utilities  bbtkGlobalError XX End\n");     
+
+*/
+
+
+printf("EED Utilities::GetExecutablePath 2.2 \n");
       }
     
     // remove the exe name
     char *slash;               
+printf("EED Utilities::GetExecutablePath 3 >%s<\n",name);
     slash = strrchr(name, VALID_FILE_SEPARATOR_CHAR);
+printf("EED Utilities::GetExecutablePath 4 \n"); 
     if (slash)
       {
        *slash = 0;
       }
+printf("EED Utilities::GetExecutablePath END \n");
     return name;
   }
   //=========================================================================