|
|
b352c10 |
diff -uNr SimGear.orig/simgear/misc/sg_path.cxx SimGear/simgear/misc/sg_path.cxx
|
|
|
b352c10 |
--- SimGear.orig/simgear/misc/sg_path.cxx 2010-01-23 12:40:37.000000000 +0100
|
|
|
b352c10 |
+++ SimGear/simgear/misc/sg_path.cxx 2010-01-31 18:40:57.477501771 +0100
|
|
|
b352c10 |
@@ -27,50 +27,12 @@
|
|
|
b352c10 |
#include <simgear_config.h>
|
|
|
b352c10 |
#include <simgear/debug/logstream.hxx>
|
|
|
b352c10 |
#include <stdio.h>
|
|
|
b352c10 |
-#include <sys/stat.h>
|
|
|
b352c10 |
-#include <sys/stat.h>
|
|
|
b352c10 |
#ifdef _WIN32
|
|
|
b352c10 |
# include <direct.h>
|
|
|
b352c10 |
#endif
|
|
|
b352c10 |
#include "sg_path.hxx"
|
|
|
b352c10 |
|
|
|
b352c10 |
|
|
|
b352c10 |
-/**
|
|
|
b352c10 |
- * define directory path separators
|
|
|
b352c10 |
- */
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-static const char sgDirPathSep = '/';
|
|
|
b352c10 |
-static const char sgDirPathSepBad = '\\';
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-#ifdef _WIN32
|
|
|
b352c10 |
-static const char sgSearchPathSep = ';';
|
|
|
b352c10 |
-#else
|
|
|
b352c10 |
-static const char sgSearchPathSep = ':';
|
|
|
b352c10 |
-#endif
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-// If Unix, replace all ":" with "/". If MacOS, replace all "/" with
|
|
|
b352c10 |
-// ":" it should go without saying that neither of these characters
|
|
|
b352c10 |
-// should be used in file or directory names. In windoze, allow the
|
|
|
b352c10 |
-// second character to be a ":" for things like c:\foo\bar
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-void
|
|
|
b352c10 |
-SGPath::fix()
|
|
|
b352c10 |
-{
|
|
|
b352c10 |
- for ( string::size_type i = 0; i < path.size(); ++i ) {
|
|
|
b352c10 |
-#if defined( WIN32 )
|
|
|
b352c10 |
- // for windoze, don't replace the ":" for the second character
|
|
|
b352c10 |
- if ( i == 1 ) {
|
|
|
b352c10 |
- continue;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
-#endif
|
|
|
b352c10 |
- if ( path[i] == sgDirPathSepBad ) {
|
|
|
b352c10 |
- path[i] = sgDirPathSep;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-
|
|
|
b352c10 |
// default constructor
|
|
|
b352c10 |
SGPath::SGPath()
|
|
|
b352c10 |
: path("")
|
|
|
b352c10 |
@@ -78,19 +40,6 @@
|
|
|
b352c10 |
}
|
|
|
b352c10 |
|
|
|
b352c10 |
|
|
|
b352c10 |
-// create a path based on "path"
|
|
|
b352c10 |
-SGPath::SGPath( const std::string& p )
|
|
|
b352c10 |
- : path(p)
|
|
|
b352c10 |
-{
|
|
|
b352c10 |
- fix();
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-// destructor
|
|
|
b352c10 |
-SGPath::~SGPath() {
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-
|
|
|
b352c10 |
// set path
|
|
|
b352c10 |
void SGPath::set( const string& p ) {
|
|
|
b352c10 |
path = p;
|
|
|
b352c10 |
@@ -98,37 +47,11 @@
|
|
|
b352c10 |
}
|
|
|
b352c10 |
|
|
|
b352c10 |
|
|
|
b352c10 |
-// append another piece to the existing path
|
|
|
b352c10 |
-void SGPath::append( const string& p ) {
|
|
|
b352c10 |
- if ( path.size() == 0 ) {
|
|
|
b352c10 |
- path = p;
|
|
|
b352c10 |
- } else {
|
|
|
b352c10 |
- if ( p[0] != sgDirPathSep ) {
|
|
|
b352c10 |
- path += sgDirPathSep;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- path += p;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- fix();
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
//add a new path component to the existing path string
|
|
|
b352c10 |
void SGPath::add( const string& p ) {
|
|
|
b352c10 |
append( sgSearchPathSep+p );
|
|
|
b352c10 |
}
|
|
|
b352c10 |
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-// concatenate a string to the end of the path without inserting a
|
|
|
b352c10 |
-// path separator
|
|
|
b352c10 |
-void SGPath::concat( const string& p ) {
|
|
|
b352c10 |
- if ( path.size() == 0 ) {
|
|
|
b352c10 |
- path = p;
|
|
|
b352c10 |
- } else {
|
|
|
b352c10 |
- path += p;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- fix();
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-
|
|
|
b352c10 |
// Get the file part of the path (everything after the last path sep)
|
|
|
b352c10 |
string SGPath::file() const {
|
|
|
b352c10 |
int index = path.rfind(sgDirPathSep);
|
|
|
b352c10 |
@@ -139,17 +62,6 @@
|
|
|
b352c10 |
}
|
|
|
b352c10 |
}
|
|
|
b352c10 |
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-// get the directory part of the path.
|
|
|
b352c10 |
-string SGPath::dir() const {
|
|
|
b352c10 |
- int index = path.rfind(sgDirPathSep);
|
|
|
b352c10 |
- if (index >= 0) {
|
|
|
b352c10 |
- return path.substr(0, index);
|
|
|
b352c10 |
- } else {
|
|
|
b352c10 |
- return "";
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
// get the base part of the path (everything but the extension.)
|
|
|
b352c10 |
string SGPath::base() const {
|
|
|
b352c10 |
int index = path.rfind(".");
|
|
|
b352c10 |
@@ -180,91 +92,3 @@
|
|
|
b352c10 |
fclose(fp);
|
|
|
b352c10 |
return true;
|
|
|
b352c10 |
}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-#ifdef _WIN32
|
|
|
b352c10 |
-# define sgMkDir(d,m) _mkdir(d)
|
|
|
b352c10 |
-#else
|
|
|
b352c10 |
-# define sgMkDir(d,m) mkdir(d,m)
|
|
|
b352c10 |
-#endif
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-int SGPath::create_dir( mode_t mode ) {
|
|
|
b352c10 |
- string_list dirlist = sgPathSplit(dir());
|
|
|
b352c10 |
- if ( dirlist.empty() )
|
|
|
b352c10 |
- return -1;
|
|
|
b352c10 |
- string path = dirlist[0];
|
|
|
b352c10 |
- string_list path_elements = sgPathBranchSplit(path);
|
|
|
b352c10 |
- bool absolute = !path.empty() && path[0] == sgDirPathSep;
|
|
|
b352c10 |
-
|
|
|
b352c10 |
- unsigned int i = 1;
|
|
|
b352c10 |
- SGPath dir = absolute ? string( 1, sgDirPathSep ) : "";
|
|
|
b352c10 |
- dir.concat( path_elements[0] );
|
|
|
b352c10 |
-#ifdef _WIN32
|
|
|
b352c10 |
- if ( dir.str().find(':') != string::npos && path_elements.size() >= 2 ) {
|
|
|
b352c10 |
- dir.append( path_elements[1] );
|
|
|
b352c10 |
- i = 2;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
-#endif
|
|
|
b352c10 |
- struct stat info;
|
|
|
b352c10 |
- int r;
|
|
|
b352c10 |
- for(; ( r = stat( dir.c_str(), &info ) ) == 0 && i < path_elements.size(); i++) {
|
|
|
b352c10 |
- dir.append(path_elements[i]);
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- if ( r == 0 ) {
|
|
|
b352c10 |
- return 0; // Directory already exists
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- if ( sgMkDir( dir.c_str(), mode) ) {
|
|
|
b352c10 |
- SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
|
|
|
b352c10 |
- return -2;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- for(; i < path_elements.size(); i++) {
|
|
|
b352c10 |
- dir.append(path_elements[i]);
|
|
|
b352c10 |
- if ( sgMkDir( dir.c_str(), mode) ) {
|
|
|
b352c10 |
- SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
|
|
|
b352c10 |
- return -2;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
-
|
|
|
b352c10 |
- return 0;
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-string_list sgPathBranchSplit( const string &dirpath ) {
|
|
|
b352c10 |
- string_list path_elements;
|
|
|
b352c10 |
- string element, path = dirpath;
|
|
|
b352c10 |
- while ( path.size() ) {
|
|
|
b352c10 |
- size_t p = path.find( sgDirPathSep );
|
|
|
b352c10 |
- if ( p != string::npos ) {
|
|
|
b352c10 |
- element = path.substr( 0, p );
|
|
|
b352c10 |
- path.erase( 0, p + 1 );
|
|
|
b352c10 |
- } else {
|
|
|
b352c10 |
- element = path;
|
|
|
b352c10 |
- path = "";
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- if ( element.size() )
|
|
|
b352c10 |
- path_elements.push_back( element );
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- return path_elements;
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-string_list sgPathSplit( const string &search_path ) {
|
|
|
b352c10 |
- string tmp = search_path;
|
|
|
b352c10 |
- string_list result;
|
|
|
b352c10 |
- result.clear();
|
|
|
b352c10 |
-
|
|
|
b352c10 |
- bool done = false;
|
|
|
b352c10 |
-
|
|
|
b352c10 |
- while ( !done ) {
|
|
|
b352c10 |
- int index = tmp.find(sgSearchPathSep);
|
|
|
b352c10 |
- if (index >= 0) {
|
|
|
b352c10 |
- result.push_back( tmp.substr(0, index) );
|
|
|
b352c10 |
- tmp = tmp.substr( index + 1 );
|
|
|
b352c10 |
- } else {
|
|
|
b352c10 |
- if ( !tmp.empty() )
|
|
|
b352c10 |
- result.push_back( tmp );
|
|
|
b352c10 |
- done = true;
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
- }
|
|
|
b352c10 |
-
|
|
|
b352c10 |
- return result;
|
|
|
b352c10 |
-}
|
|
|
b352c10 |
diff -uNr SimGear.orig/simgear/misc/sg_path.hxx SimGear/simgear/misc/sg_path.hxx
|
|
|
b352c10 |
--- SimGear.orig/simgear/misc/sg_path.hxx 2008-07-28 09:52:14.000000000 +0200
|
|
|
b352c10 |
+++ SimGear/simgear/misc/sg_path.hxx 2010-01-31 18:41:03.790503865 +0100
|
|
|
b352c10 |
@@ -29,6 +29,8 @@
|
|
|
b352c10 |
#define _SG_PATH_HXX
|
|
|
b352c10 |
|
|
|
b352c10 |
#include <sys/types.h>
|
|
|
b352c10 |
+#include <sys/stat.h>
|
|
|
b352c10 |
+#include <simgear/debug/logstream.hxx>
|
|
|
b352c10 |
|
|
|
b352c10 |
#include <simgear/compiler.h>
|
|
|
b352c10 |
#include <string>
|
|
|
b352c10 |
@@ -42,6 +44,65 @@
|
|
|
b352c10 |
#endif
|
|
|
b352c10 |
|
|
|
b352c10 |
/**
|
|
|
b352c10 |
+ * define directory path separators
|
|
|
b352c10 |
+ */
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+static const char sgDirPathSep = '/';
|
|
|
b352c10 |
+static const char sgDirPathSepBad = '\\';
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+#ifdef _WIN32
|
|
|
b352c10 |
+static const char sgSearchPathSep = ';';
|
|
|
b352c10 |
+#else
|
|
|
b352c10 |
+static const char sgSearchPathSep = ':';
|
|
|
b352c10 |
+#endif
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+/**
|
|
|
b352c10 |
+ * Split a directory string into a list of it's parent directories.
|
|
|
b352c10 |
+ */
|
|
|
b352c10 |
+static inline string_list sgPathBranchSplit( const string &dirpath ) {
|
|
|
b352c10 |
+ string_list path_elements;
|
|
|
b352c10 |
+ string element, path = dirpath;
|
|
|
b352c10 |
+ while ( path.size() ) {
|
|
|
b352c10 |
+ size_t p = path.find( sgDirPathSep );
|
|
|
b352c10 |
+ if ( p != string::npos ) {
|
|
|
b352c10 |
+ element = path.substr( 0, p );
|
|
|
b352c10 |
+ path.erase( 0, p + 1 );
|
|
|
b352c10 |
+ } else {
|
|
|
b352c10 |
+ element = path;
|
|
|
b352c10 |
+ path = "";
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ if ( element.size() )
|
|
|
b352c10 |
+ path_elements.push_back( element );
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ return path_elements;
|
|
|
b352c10 |
+}
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+/**
|
|
|
b352c10 |
+ * Split a directory search path into a vector of individual paths
|
|
|
b352c10 |
+ */
|
|
|
b352c10 |
+static inline string_list sgPathSplit( const string &search_path ) {
|
|
|
b352c10 |
+ string tmp = search_path;
|
|
|
b352c10 |
+ string_list result;
|
|
|
b352c10 |
+ result.clear();
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+ bool done = false;
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+ while ( !done ) {
|
|
|
b352c10 |
+ int index = tmp.find(sgSearchPathSep);
|
|
|
b352c10 |
+ if (index >= 0) {
|
|
|
b352c10 |
+ result.push_back( tmp.substr(0, index) );
|
|
|
b352c10 |
+ tmp = tmp.substr( index + 1 );
|
|
|
b352c10 |
+ } else {
|
|
|
b352c10 |
+ if ( !tmp.empty() )
|
|
|
b352c10 |
+ result.push_back( tmp );
|
|
|
b352c10 |
+ done = true;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+ return result;
|
|
|
b352c10 |
+}
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+/**
|
|
|
b352c10 |
* A class to hide path separator difference across platforms and assist
|
|
|
b352c10 |
* in managing file system path names.
|
|
|
b352c10 |
*
|
|
|
b352c10 |
@@ -64,10 +125,13 @@
|
|
|
b352c10 |
* Construct a path based on the starting path provided.
|
|
|
b352c10 |
* @param p initial path
|
|
|
b352c10 |
*/
|
|
|
b352c10 |
- SGPath( const string& p );
|
|
|
b352c10 |
+ SGPath( const string& p ) : path(p)
|
|
|
b352c10 |
+ {
|
|
|
b352c10 |
+ fix();
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
|
|
|
b352c10 |
/** Destructor */
|
|
|
b352c10 |
- ~SGPath();
|
|
|
b352c10 |
+ ~SGPath() {}
|
|
|
b352c10 |
|
|
|
b352c10 |
/**
|
|
|
b352c10 |
* Set path to a new value
|
|
|
b352c10 |
@@ -80,7 +144,17 @@
|
|
|
b352c10 |
* Append another piece to the existing path. Inserts a path
|
|
|
b352c10 |
* separator between the existing component and the new component.
|
|
|
b352c10 |
* @param p additional path component */
|
|
|
b352c10 |
- void append( const string& p );
|
|
|
b352c10 |
+ void append( const string& p ) {
|
|
|
b352c10 |
+ if ( path.size() == 0 ) {
|
|
|
b352c10 |
+ path = p;
|
|
|
b352c10 |
+ } else {
|
|
|
b352c10 |
+ if ( p[0] != sgDirPathSep ) {
|
|
|
b352c10 |
+ path += sgDirPathSep;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ path += p;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ fix();
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
|
|
|
b352c10 |
/**
|
|
|
b352c10 |
* Append a new piece to the existing path. Inserts a search path
|
|
|
b352c10 |
@@ -93,7 +167,14 @@
|
|
|
b352c10 |
* path separator.
|
|
|
b352c10 |
* @param p additional path suffix
|
|
|
b352c10 |
*/
|
|
|
b352c10 |
- void concat( const string& p );
|
|
|
b352c10 |
+ void concat( const string& p ) {
|
|
|
b352c10 |
+ if ( path.size() == 0 ) {
|
|
|
b352c10 |
+ path = p;
|
|
|
b352c10 |
+ } else {
|
|
|
b352c10 |
+ path += p;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ fix();
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
|
|
|
b352c10 |
/**
|
|
|
b352c10 |
* Get the file part of the path (everything after the last path sep)
|
|
|
b352c10 |
@@ -105,7 +186,14 @@
|
|
|
b352c10 |
* Get the directory part of the path.
|
|
|
b352c10 |
* @return directory string
|
|
|
b352c10 |
*/
|
|
|
b352c10 |
- string dir() const;
|
|
|
b352c10 |
+ string dir() const {
|
|
|
b352c10 |
+ int index = path.rfind(sgDirPathSep);
|
|
|
b352c10 |
+ if (index >= 0) {
|
|
|
b352c10 |
+ return path.substr(0, index);
|
|
|
b352c10 |
+ } else {
|
|
|
b352c10 |
+ return "";
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
|
|
|
b352c10 |
/**
|
|
|
b352c10 |
* Get the base part of the path (everything but the extension.)
|
|
|
b352c10 |
@@ -141,26 +229,76 @@
|
|
|
b352c10 |
* Create the designated directory.
|
|
|
b352c10 |
* @return 0 on success, or <0 on failure.
|
|
|
b352c10 |
*/
|
|
|
b352c10 |
- int create_dir(mode_t mode);
|
|
|
b352c10 |
+ int create_dir(mode_t mode) {
|
|
|
b352c10 |
+ string_list dirlist = sgPathSplit(dir());
|
|
|
b352c10 |
+ if ( dirlist.empty() )
|
|
|
b352c10 |
+ return -1;
|
|
|
b352c10 |
+ string path = dirlist[0];
|
|
|
b352c10 |
+ string_list path_elements = sgPathBranchSplit(path);
|
|
|
b352c10 |
+ bool absolute = !path.empty() && path[0] == sgDirPathSep;
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+ unsigned int i = 1;
|
|
|
b352c10 |
+ SGPath dir = absolute ? string( 1, sgDirPathSep ) : "";
|
|
|
b352c10 |
+ dir.concat( path_elements[0] );
|
|
|
b352c10 |
+#ifdef _WIN32
|
|
|
b352c10 |
+ if ( dir.str().find(':') != string::npos && path_elements.size() >= 2 ) {
|
|
|
b352c10 |
+ dir.append( path_elements[1] );
|
|
|
b352c10 |
+ i = 2;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+#endif
|
|
|
b352c10 |
+ struct stat info;
|
|
|
b352c10 |
+ int r;
|
|
|
b352c10 |
+ for(; ( r = stat( dir.c_str(), &info ) ) == 0 && i < path_elements.size(); i++) {
|
|
|
b352c10 |
+ dir.append(path_elements[i]);
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ if ( r == 0 ) {
|
|
|
b352c10 |
+ return 0; // Directory already exists
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+#ifdef _WIN32
|
|
|
b352c10 |
+# define sgMkDir(d,m) _mkdir(d)
|
|
|
b352c10 |
+#else
|
|
|
b352c10 |
+# define sgMkDir(d,m) mkdir(d,m)
|
|
|
b352c10 |
+#endif
|
|
|
b352c10 |
+ if ( sgMkDir( dir.c_str(), mode) ) {
|
|
|
b352c10 |
+ SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
|
|
|
b352c10 |
+ return -2;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ for(; i < path_elements.size(); i++) {
|
|
|
b352c10 |
+ dir.append(path_elements[i]);
|
|
|
b352c10 |
+ if ( sgMkDir( dir.c_str(), mode) ) {
|
|
|
b352c10 |
+ SG_LOG( SG_IO, SG_ALERT, "Error creating directory: " + dir.str() );
|
|
|
b352c10 |
+ return -2;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+ return 0;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
|
|
|
b352c10 |
private:
|
|
|
b352c10 |
|
|
|
b352c10 |
- void fix();
|
|
|
b352c10 |
+ // If Unix, replace all ":" with "/". If MacOS, replace all "/" with
|
|
|
b352c10 |
+ // ":" it should go without saying that neither of these characters
|
|
|
b352c10 |
+ // should be used in file or directory names. In windoze, allow the
|
|
|
b352c10 |
+ // second character to be a ":" for things like c:\foo\bar
|
|
|
b352c10 |
+
|
|
|
b352c10 |
+ void fix()
|
|
|
b352c10 |
+ {
|
|
|
b352c10 |
+ for ( string::size_type i = 0; i < path.size(); ++i ) {
|
|
|
b352c10 |
+#if defined( WIN32 )
|
|
|
b352c10 |
+ // for windoze, don't replace the ":" for the second character
|
|
|
b352c10 |
+ if ( i == 1 ) {
|
|
|
b352c10 |
+ continue;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+#endif
|
|
|
b352c10 |
+ if ( path[i] == sgDirPathSepBad ) {
|
|
|
b352c10 |
+ path[i] = sgDirPathSep;
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
+ }
|
|
|
b352c10 |
|
|
|
b352c10 |
};
|
|
|
b352c10 |
|
|
|
b352c10 |
|
|
|
b352c10 |
-/**
|
|
|
b352c10 |
- * Split a directory string into a list of it's parent directories.
|
|
|
b352c10 |
- */
|
|
|
b352c10 |
-string_list sgPathBranchSplit( const string &path );
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-/**
|
|
|
b352c10 |
- * Split a directory search path into a vector of individual paths
|
|
|
b352c10 |
- */
|
|
|
b352c10 |
-string_list sgPathSplit( const string &search_path );
|
|
|
b352c10 |
-
|
|
|
b352c10 |
-
|
|
|
b352c10 |
#endif // _SG_PATH_HXX
|
|
|
b352c10 |
|
|
|
b352c10 |
|