From 88864c47e2015c70e0164ba74cea98a3eef21475 Mon Sep 17 00:00:00 2001 From: Eduardo Davila Date: Mon, 22 Mar 2010 19:11:47 +0000 Subject: [PATCH] no message --- src/creaSystem.cxx | 29 +++++++++++++++++++++++++++++ src/creaSystem.h | 6 ++++-- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/creaSystem.cxx b/src/creaSystem.cxx index 7225884..7060109 100644 --- a/src/creaSystem.cxx +++ b/src/creaSystem.cxx @@ -183,4 +183,33 @@ std::string System::GetDllAppPath(std::string nomdll){ return path; } + + +#if defined(_WIN32) +#define CREACONTOUR_VALID_FILE_SEPARATOR_CHAR '\\' +#else +#define CREACONTOUR_VALID_FILE_SEPARATOR_CHAR '/' +#endif + + //========================================================================= +std::string System::GetExecutablePath(){ + char name[PATH_MAX]; + //EED int err = get_app_path(name, PATH_MAX); + int err = System::GetAppPath(name,PATH_MAX); + if (err) + { + printf("Could not determine current executable path ? "); + } + // remove the exe name + char *slash; + slash = strrchr(name, CREACONTOUR_VALID_FILE_SEPARATOR_CHAR); + if (slash) + { + *slash = 0; + } + return name; + } + + + } // namespace crea diff --git a/src/creaSystem.h b/src/creaSystem.h index c9011c3..f16ccbc 100644 --- a/src/creaSystem.h +++ b/src/creaSystem.h @@ -3,8 +3,8 @@ Program: crea Module: $RCSfile: creaSystem.h,v $ Language: C++ - Date: $Date: 2009/10/09 14:09:20 $ - Version: $Revision: 1.8 $ + Date: $Date: 2010/03/22 19:11:47 $ + Version: $Revision: 1.9 $ Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de l'Image). All rights reserved. See Doc/License.txt or @@ -226,6 +226,8 @@ namespace crea 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 std::string GetExecutablePath(); + }; } // namespace crea -- 2.45.1