Change sgSearchPathSep into a public static member: SGPath::pathListSep

This way, one can easily use the OS-dependent separarator for path lists in
other places to build and split path lists in an optimal way (e.g., not
sacrificing ';' on Unix, since the path list separator is ':' on this
platform).
This commit is contained in:
Florent Rougon
2016-10-12 09:05:21 +02:00
parent dd52b6af50
commit 412111ba5a
2 changed files with 7 additions and 4 deletions
+4 -4
View File
@@ -53,9 +53,9 @@ static const char sgDirPathSep = '/';
static const char sgDirPathSepBad = '\\';
#ifdef _WIN32
static const char sgSearchPathSep = ';';
const char SGPath::pathListSep = ';';
#else
static const char sgSearchPathSep = ':';
const char SGPath::pathListSep = ':';
#endif
#ifdef _WIN32
@@ -334,7 +334,7 @@ SGPath SGPath::operator/( const std::string& p ) const
#if defined(ENABLE_OLD_PATH_API)
//add a new path component to the existing path string
void SGPath::add( const string& p ) {
append( sgSearchPathSep+p );
append( SGPath::pathListSep+p );
}
#endif
@@ -644,7 +644,7 @@ string_list sgPathSplit( const string &search_path ) {
bool done = false;
while ( !done ) {
int index = tmp.find(sgSearchPathSep);
int index = tmp.find(SGPath::pathListSep);
if (index >= 0) {
result.push_back( tmp.substr(0, index) );
tmp = tmp.substr( index + 1 );
+3
View File
@@ -52,6 +52,9 @@ class SGPath {
public:
// OS-dependent separator used in paths lists
static const char pathListSep;
struct Permissions
{
bool read : 1;