+
+// get the extention (everything after the final ".")
+string SGPath::extension() const {
+ int index = path.rfind(".");
+ if (index >= 0) {
+ return path.substr(index + 1);
+ } else {
+ return "";
+ }
+}
+
+bool SGPath::exists() const {
+ FILE* fp = fopen( path.c_str(), "r");
+ if (fp == 0) {
+ return false;
+ }
+ fclose(fp);
+ return true;
+}
+
+
+string_list sgPathSplit( const string &search_path ) {
+ string tmp = search_path;
+ string_list result;
+ result.clear();
+
+ bool done = false;
+
+ while ( !done ) {
+ int index = tmp.find(sgSearchPathSep);
+ if (index >= 0) {
+ result.push_back( tmp.substr(0, index) );
+ tmp = tmp.substr( index + 1 );
+ } else {
+ result.push_back( tmp );
+ done = true;
+ }
+ }
+
+ return result;
+}