}
+// Get the file part of the path (everything after the last path sep)
+string SGPath::file() {
+ int index = path.rfind(SG_PATH_SEP);
+ if (index >= 0) {
+ return path.substr(index + 1);
+ } else {
+ return "";
+ }
+}
+
+
// get the directory part of the path.
string SGPath::dir() {
int index = path.rfind(SG_PATH_SEP);
}
}
-string SGPath::filename() {
- int index = path.rfind(SG_PATH_SEP);
- if (index < 0) index = 0;
- return path.substr(index);
+// get the base part of the path (everything but the extension.)
+string SGPath::base() {
+ int index = path.rfind(".");
+ if (index >= 0) {
+ return path.substr(0, index);
+ } else {
+ return "";
+ }
+}
+
+// get the extention (everything after the final ".")
+string SGPath::extension() {
+ int index = path.rfind(".");
+ if (index >= 0) {
+ return path.substr(index + 1);
+ } else {
+ return "";
+ }
}
bool SGPath::exists() const {
*/
void concat( const string& p );
+ /**
+ * Get the file part of the path (everything after the last path sep)
+ * @return file string
+ */
+ string file();
+
/**
* Get the directory part of the path.
* @return directory string
string dir();
/**
- * Return the filename part of the path.
- * @return file name string
+ * Get the base part of the path (everything but the extension.)
+ * @return the base string
*/
- string filename();
-
+ string base();
+
+ /**
+ * Get the extention part of the path (everything after the final ".")
+ * @return the extention string
+ */
+ string extension();
+
/** Get the path string
* @return path string
*/