]> Creatis software - crea.git/commitdiff
Add GetDllAppPath(const char *nomdll);
authorjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Tue, 20 Apr 2010 12:19:46 +0000 (12:19 +0000)
committerjean-pierre roux <jean-pierre.roux@creatis.insa-lyon.fr>
Tue, 20 Apr 2010 12:19:46 +0000 (12:19 +0000)
src/creaSystem.cxx
src/creaSystem.h

index 69293a982369586e718dd76c6bfe73a4062a7ea4..32051781a6eb9631bd03f6184324c89b7c214d82 100644 (file)
@@ -180,6 +180,22 @@ std::string System::GetDllAppPath(std::string &nomdll){
        return path;
 }
 
+
+std::string System::GetDllAppPath(const char *nomdll){
+       std::string path = ".";
+#ifdef WIN32
+       char currentPath[_MAX_PATH];
+       HMODULE hand = GetModuleHandle(nomdll);
+       GetModuleFileName(hand, currentPath, _MAX_PATH);
+
+       path = currentPath;
+
+       path = path.substr(0,path.find_last_of("\\"));
+#endif
+       return path;
+}
+
+
 #if defined(_WIN32)
 #define CREACONTOUR_VALID_FILE_SEPARATOR_CHAR '\\'
 #else
index 3e1142b63d2ca1b9e37935ce215ecdb71afa4e51..3a5b8d59e328c60db460cfca2410d3f480f02730 100644 (file)
@@ -3,8 +3,8 @@
   Program:   crea
   Module:    $RCSfile: creaSystem.h,v $
   Language:  C++
-  Date:      $Date: 2010/04/01 11:05:21 $
-  Version:   $Revision: 1.10 $
+  Date:      $Date: 2010/04/20 12:19:46 $
+  Version:   $Revision: 1.11 $
                                                                                 
   Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
   l'Image). All rights reserved. See Doc/License.txt or
@@ -202,8 +202,6 @@ typedef  unsigned int        uint32_t;
 #define UINT32_MAX    (4294967295U)
 #endif
 
-
-
 //-----------------------------------------------------------------------------
 
 
@@ -216,10 +214,10 @@ namespace crea
   {
     /// returns true iff the program has a tty
     static int HasTTY(); 
-       CREA_EXPORT static int GetAppPath(char *pname, size_t pathsize);
-       CREA_EXPORT static std::string GetDllAppPath(std::string &nomdll);
+    CREA_EXPORT static int GetAppPath(char *pname, size_t pathsize);
+    CREA_EXPORT static std::string GetDllAppPath(std::string &nomdll);
+    CREA_EXPORT static std::string GetDllAppPath(const char *nomdll);   
     CREA_EXPORT static std::string GetExecutablePath();
-
   };
 
 } // namespace crea