From 412111ba5a053e7c61c7c47f5e3dcf303765c622 Mon Sep 17 00:00:00 2001 From: Florent Rougon Date: Fri, 7 Oct 2016 01:45:15 +0200 Subject: [PATCH] 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). --- simgear/misc/sg_path.cxx | 8 ++++---- simgear/misc/sg_path.hxx | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index 2ff8f40b..cea104b2 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -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 ); diff --git a/simgear/misc/sg_path.hxx b/simgear/misc/sg_path.hxx index a35c64e4..25a8064c 100644 --- a/simgear/misc/sg_path.hxx +++ b/simgear/misc/sg_path.hxx @@ -52,6 +52,9 @@ class SGPath { public: + // OS-dependent separator used in paths lists + static const char pathListSep; + struct Permissions { bool read : 1;