]> git.mxchange.org Git - simgear.git/blobdiff - simgear/misc/sg_path.hxx
Make tsync part of libSimGearCore when building shared libraries
[simgear.git] / simgear / misc / sg_path.hxx
index 27b375d9d0ff8fe1e59aac52f8c840bc33f1f99b..1f9dfbe706c4d3a0d663001e4d977d5446be907a 100644 (file)
@@ -111,6 +111,12 @@ public:
      */
     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
@@ -124,7 +130,7 @@ public:
     std::string dir() const;
   
     /**
-     * Get the base part of the path (everything but the extension.)
+     * Get the base part of the path (everything but the final extension.)
      * @return the base string
      */
     std::string base() const;
@@ -213,6 +219,13 @@ public:
      * modification time of the file
      */
     time_t modTime() const;
+    
+    /**
+     * rename the file / directory we point at, to a new name
+     * this may fail if the new location is on a different volume / share,
+     * or if the destination already exists, or is not writeable
+     */
+    bool rename(const SGPath& newName);
 private:
 
     void fix();
@@ -229,6 +242,13 @@ private:
     mutable time_t _modTime;
 };
 
+/// Output to an ostream
+template<typename char_type, typename traits_type>
+inline
+std::basic_ostream<char_type, traits_type>&
+operator<<(std::basic_ostream<char_type, traits_type>& s, const SGPath& p)
+{ return s << "Path \"" << p.str() << "\""; }
+
 
 /**
  * Split a directory string into a list of it's parent directories.