diff --git a/goldlib/gall/gfilutil.h b/goldlib/gall/gfilutil.h index 4f5cf8f..ee82e59 100644 --- a/goldlib/gall/gfilutil.h +++ b/goldlib/gall/gfilutil.h @@ -200,6 +200,7 @@ std::string& AddBackslash(std::string& p); // Remove one trailing directory-delimiter character ('\\' in DOS-based, '/' in unix-based OS) char* StripBackslash(char* p); +std::string& StripBackslash(std::string& p); // Copy pathname with enviroment variables substitution and adds directory delimiter char. // Copy not more sizeof(Path) characters (__dst should be type "Path" or equvalence, size is GMAXPATH) diff --git a/goldlib/gall/gfilutl2.cpp b/goldlib/gall/gfilutl2.cpp index 7338aa7..526f728 100644 --- a/goldlib/gall/gfilutl2.cpp +++ b/goldlib/gall/gfilutl2.cpp @@ -49,6 +49,18 @@ std::string& AddBackslash(std::string& p) { return p; } +// ------------------------------------------------------------------ +// Remove one trailing directory-delimiter character ('\\' in DOS-based, '/' in unix-based OS) + +std::string& StripBackslash(std::string& p) { + + std::string::iterator pend = p.end(); + + if(isslash(*pend)) + p.erase(pend); + + return p; +} // ------------------------------------------------------------------ // Add path to filename, if no path is set. Don't chech size of 'path', be careful!