X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=kernel%2Fsrc%2FbbtkUtilities.cxx;h=7c02a604027393f9c4075cde07bd0f05c530a2ec;hb=1688b52778caa9985ecea38aad38341817e0401a;hp=21fa9479f3ceb892e86e48b51a177caa9a57d885;hpb=8822f9075c66dcf742b9edae47271bb46af6a9b7;p=bbtk.git diff --git a/kernel/src/bbtkUtilities.cxx b/kernel/src/bbtkUtilities.cxx index 21fa947..7c02a60 100644 --- a/kernel/src/bbtkUtilities.cxx +++ b/kernel/src/bbtkUtilities.cxx @@ -2,8 +2,8 @@ Program: bbtk Module: $RCSfile: bbtkUtilities.cxx,v $ Language: C++ - Date: $Date: 2009/01/27 14:22:57 $ - Version: $Revision: 1.11 $ + Date: $Date: 2009/10/05 22:44:48 $ + Version: $Revision: 1.14 $ =========================================================================*/ /* --------------------------------------------------------------------- @@ -32,7 +32,18 @@ #include "bbtkUtilities.h" #include "bbtkMessageManager.h" - +#if defined(MACOSX) // assume this is OSX +# include +# include // _NSGetExecutablePath : must add -framework CoreFoundation to link line +# include +# ifndef PATH_MAX +# define PATH_MAX MAXPATHLEN +# endif +#endif // MACOSX + +#ifndef PATH_MAX // If not defined yet : do it +# define PATH_MAX 2048 +#endif namespace bbtk { @@ -254,7 +265,8 @@ namespace bbtk std::string Utilities::MakeLibnameFromPath(std::string path, std::string pkgname) { std::string libname = path; - char c = path[path.size()-1]; + if(path.size()>0){ + char c = path[path.size()-1]; #if defined(__GNUC__) if (c != '/') libname += "/libbb"; @@ -268,11 +280,15 @@ namespace bbtk #endif #elif defined(_WIN32) - if (c != '\\') - libname = path+"\\bb"; + if (c != '\\') + libname += "\\bb"; + else + libname += "bb"; libname += pkgname; libname += ".dll"; #endif + } + return libname; } @@ -281,23 +297,26 @@ namespace bbtk std::string Utilities::MakePkgnameFromPath(std::string path, std::string pkgname, bool addExt) { std::string libname = path; - char c = path[path.size()-1]; - if (c != '/' && c != '\\') - { - libname += ConfigurationFile::GetInstance().Get_file_separator (); - } - libname += pkgname; - if (addExt) - { - int l = libname.size(); - if (l>4) - { - if (libname.substr(l-4, 4) != ".bbs") - { - libname = libname + ".bbs"; - } - } - } + if(path.size()>0){ + char c = path[path.size()-1]; + if (c != '/' && c != '\\') + { + libname += ConfigurationFile::GetInstance().Get_file_separator (); + } + libname += pkgname; + if (addExt) + { + int l = libname.size(); + if (l>4) + { + if (libname.substr(l-4, 4) != ".bbs") + { + libname = libname + ".bbs"; + } + } + } + } + return libname; } // =======================================================================