Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
Copyright (c) CREATIS (Centre de Recherche et d'Applications en Traitement de
l'Image). All rights reserved. See doc/license.txt or
// See : http://www.techbytes.ca/techbyte103.html for more O.S.
static inline bool FileExists(std::string strFilename)
{
// See : http://www.techbytes.ca/techbyte103.html for more O.S.
static inline bool FileExists(std::string strFilename)
{
std::string::size_type slash_position = name.find_last_of("/\\");
if (slash_position != std::string::npos)
std::string::size_type slash_position = name.find_last_of("/\\");
if (slash_position != std::string::npos)
- {
- pkgname = name.substr(slash_position+1,std::string::npos);
- path = name.substr(0,slash_position);
- // std::cout << "F:P='"<<path<<"'"<<std::endl;//+1,std::string::npos);
- }
+ {
+ pkgname = name.substr(slash_position+1,std::string::npos);
+ path = name.substr(0,slash_position);
+ // std::cout << "F:P='"<<path<<"'"<<std::endl;//+1,std::string::npos);
+ }
// remove {.so | dll} if any
std::string::size_type dot_position = pkgname.find_last_of('.');
if (dot_position != std::string::npos){
pkgname = pkgname.substr(0,dot_position);
}
#if defined(__GNUC__)
// remove {.so | dll} if any
std::string::size_type dot_position = pkgname.find_last_of('.');
if (dot_position != std::string::npos){
pkgname = pkgname.substr(0,dot_position);
}
#if defined(__GNUC__)
// remove {bb} if any
if (memcmp (pkgname.c_str(), "bb", 2) == 0) {
pkgname = pkgname.substr(2, pkgname.length());
// remove {bb} if any
if (memcmp (pkgname.c_str(), "bb", 2) == 0) {
pkgname = pkgname.substr(2, pkgname.length());
/*
/// \ \todo what would happen if (stupid) user names his package 'bb' ?!?
/// \ --> Should be forbidden!
/*
/// \ \todo what would happen if (stupid) user names his package 'bb' ?!?
/// \ --> Should be forbidden!
char * currentDir = getcwd(buf, 2048);
std::string cwd(currentDir);
std::string libname(name);
char * currentDir = getcwd(buf, 2048);
std::string cwd(currentDir);
std::string libname(name);
- }
- else if ( name[0] == '.' && name[1] == '.' && (name[2] == '/' || name[2] == '\\') )
+ }
+ else if (name[0] == '.' && (name[1] == '/' || name[1] == '\\') )
+ {
+ libname = cwd + fileSeparator + name.substr(2, name.length());
+ return(libname);
+ }
+ else if ( name[0] == '.' && name[1] == '.' /* && (name[2] == '/' || name[2] == '\\') */ )
if (slash_position != std::string::npos) {
if (slash_position == 0)
slash_position = 1;
cwd = cwd.substr(0,slash_position/*+1*/);
if (slash_position != std::string::npos) {
if (slash_position == 0)
slash_position = 1;
cwd = cwd.substr(0,slash_position/*+1*/);
- a = a.substr(3, name.length()); // remove ../
+//std::cout << "------------------cwd [" << cwd << "]" << std::endl;
+ // if (a == "..") {
+ // a = "";
+ // break;
+ // }
+ // else
+ a = a.substr(3, /*name.length()*/ a.length()); // remove ../
+//std::cout << "------------------a [" << a << "]" << std::endl;
// ===================================================================================
static inline void SplitAroundFirstDot( const std::string& in,
// ===================================================================================
static inline void SplitAroundFirstDot( const std::string& in,
static inline std::string get_file_name(const std::string& s)
{
std::string::size_type slash_position = s.find_last_of("/\\");
static inline std::string get_file_name(const std::string& s)
{
std::string::size_type slash_position = s.find_last_of("/\\");
- // Usefull functions for html generation
-
- //========================================================================
+ // Usefull functions for html generation
+ //========================================================================
+
static inline void html_format(std::string& str)
{
replace( str, "&", "&" );
static inline void html_format(std::string& str)
{
replace( str, "&", "&" );