_modTime(p._modTime)
{
}
-
+
SGPath& SGPath::operator=(const SGPath& p)
{
path = p.path;
// append another piece to the existing path
void SGPath::append( const string& p ) {
if ( path.size() == 0 ) {
- path = p;
+ path = p;
} else {
if ( p[0] != sgDirPathSep ) {
path += sgDirPathSep;
}
- path += p;
+ path += p;
}
fix();
_cached = false;
// path separator
void SGPath::concat( const string& p ) {
if ( path.size() == 0 ) {
- path = p;
+ path = p;
} else {
- path += p;
+ path += p;
}
fix();
_cached = false;
return true;
}
+std::string SGPath::realpath() const
+{
+#ifdef _WIN32
+ // Not implemented for Windows yet. Return original path instead.
+ return path;
+#else
+ char* buf = ::realpath(path.c_str(), NULL);
+ std::string p(buf);
+ free(buf);
+ return p;
+#endif
+}
+
*/
void concat( const std::string& p );
+ /**
+ * Returns a string with the absolute pathname that names the same file, whose
+ * resolution does not involve '.', '..', or symbolic links.
+ */
+ std::string realpath() const;
+
/**
* Get the file part of the path (everything after the last path sep)
* @return file string