LLVM API Documentation
00001 //===- llvm/System/Path.h - Path Operating System Concept -------*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by Reid Spencer and is distributed under the 00006 // University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file declares the llvm::sys::Path class. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #ifndef LLVM_SYSTEM_PATH_H 00015 #define LLVM_SYSTEM_PATH_H 00016 00017 #include "llvm/System/TimeValue.h" 00018 #include <set> 00019 #include <string> 00020 #include <vector> 00021 #include <ostream> 00022 00023 namespace llvm { 00024 namespace sys { 00025 00026 /// This class provides an abstraction for the path to a file or directory 00027 /// in the operating system's filesystem and provides various basic operations 00028 /// on it. Note that this class only represents the name of a path to a file 00029 /// or directory which may or may not be valid for a given machine's file 00030 /// system. The class is patterned after the java.io.File class with various 00031 /// extensions and several omissions (not relevant to LLVM). A Path object 00032 /// ensures that the path it encapsulates is syntactically valid for the 00033 /// operating system it is running on but does not ensure correctness for 00034 /// any particular file system. That is, a syntactically valid path might 00035 /// specify path components that do not exist in the file system and using 00036 /// such a Path to act on the file system could produce errors. There is one 00037 /// invalid Path value which is permitted: the empty path. The class should 00038 /// never allow a syntactically invalid non-empty path name to be assigned. 00039 /// Empty paths are required in order to indicate an error result in some 00040 /// situations. If the path is empty, the isValid operation will return 00041 /// false. All operations will fail if isValid is false. Operations that 00042 /// change the path will either return false if it would cause a syntactically 00043 /// invalid path name (in which case the Path object is left unchanged) or 00044 /// throw an std::string exception indicating the error. The methods are 00045 /// grouped into four basic categories: Path Accessors (provide information 00046 /// about the path without accessing disk), Disk Accessors (provide 00047 /// information about the underlying file or directory), Path Mutators 00048 /// (change the path information, not the disk), and Disk Mutators (change 00049 /// the disk file/directory referenced by the path). The Disk Mutator methods 00050 /// all have the word "disk" embedded in their method name to reinforce the 00051 /// notion that the operation modifies the file system. 00052 /// @since 1.4 00053 /// @brief An abstraction for operating system paths. 00054 class Path { 00055 /// @name Types 00056 /// @{ 00057 public: 00058 /// This structure provides basic file system information about a file. It 00059 /// is patterned after the stat(2) Unix operating system call but made 00060 /// platform independent and eliminates many of the unix-specific fields. 00061 /// However, to support llvm-ar, the mode, user, and group fields are 00062 /// retained. These pertain to unix security and may not have a meaningful 00063 /// value on non-Unix platforms. However, the fileSize and modTime fields 00064 /// should always be applicabe on all platforms. The structure is 00065 /// filled in by the getStatusInfo method. 00066 /// @brief File status structure 00067 struct StatusInfo { 00068 StatusInfo() : fileSize(0), modTime(0,0), mode(0777), user(999), 00069 group(999), isDir(false) { } 00070 size_t fileSize; ///< Size of the file in bytes 00071 TimeValue modTime; ///< Time of file's modification 00072 uint32_t mode; ///< Mode of the file, if applicable 00073 uint32_t user; ///< User ID of owner, if applicable 00074 uint32_t group; ///< Group ID of owner, if applicable 00075 bool isDir; ///< True if this is a directory. 00076 }; 00077 00078 /// @} 00079 /// @name Constructors 00080 /// @{ 00081 public: 00082 /// Construct a path to the root directory of the file system. The root 00083 /// directory is a top level directory above which there are no more 00084 /// directories. For example, on UNIX, the root directory is /. On Windows 00085 /// it is C:\. Other operating systems may have different notions of 00086 /// what the root directory is or none at all. In that case, a consistent 00087 /// default root directory will be used. 00088 static Path GetRootDirectory(); 00089 00090 /// Construct a path to a unique temporary directory that is created in 00091 /// a "standard" place for the operating system. The directory is 00092 /// guaranteed to be created on exit from this function. If the directory 00093 /// cannot be created, the function will throw an exception. 00094 /// @throws std::string indicating why the directory could not be created. 00095 /// @brief Constrct a path to an new, unique, existing temporary 00096 /// directory. 00097 static Path GetTemporaryDirectory(); 00098 00099 /// Construct a vector of sys::Path that contains the "standard" system 00100 /// library paths suitable for linking into programs. This function *must* 00101 /// return the value of LLVM_LIB_SEARCH_PATH as the first item in \p Paths 00102 /// if that environment variable is set and it references a directory. 00103 /// @brief Construct a path to the system library directory 00104 static void GetSystemLibraryPaths(std::vector<sys::Path>& Paths); 00105 00106 /// Construct a vector of sys::Path that contains the "standard" bytecode 00107 /// library paths suitable for linking into an llvm program. This function 00108 /// *must* return the value of LLVM_LIB_SEARCH_PATH as well as the value 00109 /// of LLVM_LIBDIR. It also must provide the System library paths as 00110 /// returned by GetSystemLibraryPaths. 00111 /// @see GetSystemLibraryPaths 00112 /// @brief Construct a list of directories in which bytecode could be 00113 /// found. 00114 static void GetBytecodeLibraryPaths(std::vector<sys::Path>& Paths); 00115 00116 /// Find the path to a library using its short name. Use the system 00117 /// dependent library paths to locate the library. 00118 /// @brief Find a library. 00119 static Path FindLibrary(std::string& short_name); 00120 00121 /// Construct a path to the default LLVM configuration directory. The 00122 /// implementation must ensure that this is a well-known (same on many 00123 /// systems) directory in which llvm configuration files exist. For 00124 /// example, on Unix, the /etc/llvm directory has been selected. 00125 /// @brief Construct a path to the default LLVM configuration directory 00126 static Path GetLLVMDefaultConfigDir(); 00127 00128 /// Construct a path to the LLVM installed configuration directory. The 00129 /// implementation must ensure that this refers to the "etc" directory of 00130 /// the LLVM installation. This is the location where configuration files 00131 /// will be located for a particular installation of LLVM on a machine. 00132 /// @brief Construct a path to the LLVM installed configuration directory 00133 static Path GetLLVMConfigDir(); 00134 00135 /// Construct a path to the current user's home directory. The 00136 /// implementation must use an operating system specific mechanism for 00137 /// determining the user's home directory. For example, the environment 00138 /// variable "HOME" could be used on Unix. If a given operating system 00139 /// does not have the concept of a user's home directory, this static 00140 /// constructor must provide the same result as GetRootDirectory. 00141 /// @brief Construct a path to the current user's "home" directory 00142 static Path GetUserHomeDirectory(); 00143 00144 /// Return the suffix commonly used on file names that contain a shared 00145 /// object, shared archive, or dynamic link library. Such files are 00146 /// linked at runtime into a process and their code images are shared 00147 /// between processes. 00148 /// @returns The dynamic link library suffix for the current platform. 00149 /// @brief Return the dynamic link library suffix. 00150 static std::string GetDLLSuffix(); 00151 00152 /// This is one of the very few ways in which a path can be constructed 00153 /// with a syntactically invalid name. The only *legal* invalid name is an 00154 /// empty one. Other invalid names are not permitted. Empty paths are 00155 /// provided so that they can be used to indicate null or error results in 00156 /// other lib/System functionality. 00157 /// @brief Construct an empty (and invalid) path. 00158 Path() : path() {} 00159 00160 /// This constructor will accept a std::string as a path but it verifies 00161 /// that the path string has a legal syntax for the operating system on 00162 /// which it is running. This allows a path to be taken in from outside 00163 /// the program. However, if the path is not valid, the Path object will 00164 /// be set to an empty string and an exception will be thrown. 00165 /// @throws std::string if \p unverified_path is not legal. 00166 /// @param unverified_path The path to verify and assign. 00167 /// @brief Construct a Path from a string. 00168 explicit Path(const std::string& unverified_path); 00169 00170 /// @} 00171 /// @name Operators 00172 /// @{ 00173 public: 00174 /// Makes a copy of \p that to \p this. 00175 /// @returns \p this 00176 /// @brief Assignment Operator 00177 Path & operator = ( const Path & that ) { 00178 path = that.path; 00179 return *this; 00180 } 00181 00182 /// Compares \p this Path with \p that Path for equality. 00183 /// @returns true if \p this and \p that refer to the same thing. 00184 /// @brief Equality Operator 00185 bool operator == (const Path& that) const { 00186 return 0 == path.compare(that.path) ; 00187 } 00188 00189 /// Compares \p this Path with \p that Path for inequality. 00190 /// @returns true if \p this and \p that refer to different things. 00191 /// @brief Inequality Operator 00192 bool operator !=( const Path & that ) const { 00193 return 0 != path.compare( that.path ); 00194 } 00195 00196 /// Determines if \p this Path is less than \p that Path. This is required 00197 /// so that Path objects can be placed into ordered collections (e.g. 00198 /// std::map). The comparison is done lexicographically as defined by 00199 /// the std::string::compare method. 00200 /// @returns true if \p this path is lexicographically less than \p that. 00201 /// @brief Less Than Operator 00202 bool operator< (const Path& that) const { 00203 return 0 > path.compare( that.path ); 00204 } 00205 00206 /// @} 00207 /// @name Path Accessors 00208 /// @{ 00209 public: 00210 /// This function will use an operating system specific algorithm to 00211 /// determine if the current value of \p this is a syntactically valid 00212 /// path name for the operating system. The path name does not need to 00213 /// exist, validity is simply syntactical. Empty paths are always invalid. 00214 /// @returns true iff the path name is syntactically legal for the 00215 /// host operating system. 00216 /// @brief Determine if a path is syntactically valid or not. 00217 bool isValid() const; 00218 00219 /// This function determines if the contents of the path name are 00220 /// empty. That is, the path has a zero length. This does NOT determine if 00221 /// if the file is empty. Use the getSize method for that. 00222 /// @returns true iff the path is empty. 00223 /// @brief Determines if the path name is empty (invalid). 00224 bool isEmpty() const { return path.empty(); } 00225 00226 /// This function returns the current contents of the path as a 00227 /// std::string. This allows the underlying path string to be manipulated. 00228 /// @returns std::string containing the path name. 00229 /// @brief Returns the path as a std::string. 00230 const std::string& toString() const { return path; } 00231 00232 /// This function returns the last component of the path name. The last 00233 /// component is the file or directory name occuring after the last 00234 /// directory separator. If no directory separator is present, the entire 00235 /// path name is returned (i.e. same as toString). 00236 /// @returns std::string containing the last component of the path name. 00237 /// @brief Returns the last component of the path name. 00238 std::string getLast() const; 00239 00240 /// This function strips off the path and suffix of the file or directory 00241 /// name and returns just the basename. For example /a/foo.bar would cause 00242 /// this function to return "foo". 00243 /// @returns std::string containing the basename of the path 00244 /// @brief Get the base name of the path 00245 std::string getBasename() const; 00246 00247 /// Obtain a 'C' string for the path name. 00248 /// @returns a 'C' string containing the path name. 00249 /// @brief Returns the path as a C string. 00250 const char* const c_str() const { return path.c_str(); } 00251 00252 /// @} 00253 /// @name Disk Accessors 00254 /// @{ 00255 public: 00256 /// This function determines if the object referenced by this path is 00257 /// a file or not. This function accesses the underlying file system to 00258 /// determine the type of entity referenced by the path. 00259 /// @returns true if this path name references a file. 00260 /// @brief Determines if the path name references a file. 00261 bool isFile() const; 00262 00263 /// This function determines if the object referenced by this path is a 00264 /// directory or not. This function accesses the underlying file system to 00265 /// determine the type of entity referenced by the path. 00266 /// @returns true if the path name references a directory 00267 /// @brief Determines if the path name references a directory. 00268 bool isDirectory() const; 00269 00270 /// This function determines if the path refers to a hidden file. The 00271 /// notion of hidden files is defined by the underlying system. The 00272 /// system may not support hidden files in which case this function always 00273 /// returns false on such systems. Hidden files have the "hidden" 00274 /// attribute set on Win32. On Unix, hidden files start with a period. 00275 /// @brief Determines if the path name references a hidden file. 00276 bool isHidden() const; 00277 00278 /// This function determines if the path name in this object references 00279 /// the root (top level directory) of the file system. The details of what 00280 /// is considered the "root" may vary from system to system so this method 00281 /// will do the necessary checking. 00282 /// @returns true iff the path name references the root directory. 00283 /// @brief Determines if the path references the root directory. 00284 bool isRootDirectory() const; 00285 00286 /// This function opens the file associated with the path name provided by 00287 /// the Path object and reads its magic number. If the magic number at the 00288 /// start of the file matches \p magic, true is returned. In all other 00289 /// cases (file not found, file not accessible, etc.) it returns false. 00290 /// @returns true if the magic number of the file matches \p magic. 00291 /// @brief Determine if file has a specific magic number 00292 bool hasMagicNumber(const std::string& magic) const; 00293 00294 /// This function retrieves the first \p len bytes of the file associated 00295 /// with \p this. These bytes are returned as the "magic number" in the 00296 /// \p Magic parameter. 00297 /// @returns true if the Path is a file and the magic number is retrieved, 00298 /// false otherwise. 00299 /// @brief Get the file's magic number. 00300 bool getMagicNumber(std::string& Magic, unsigned len) const; 00301 00302 /// This function determines if the path name in the object references an 00303 /// archive file by looking at its magic number. 00304 /// @returns true if the file starts with the magic number for an archive 00305 /// file. 00306 /// @brief Determine if the path references an archive file. 00307 bool isArchive() const; 00308 00309 /// This function determines if the path name in the object references an 00310 /// LLVM Bytecode file by looking at its magic number. 00311 /// @returns true if the file starts with the magic number for LLVM 00312 /// bytecode files. 00313 /// @brief Determine if the path references a bytecode file. 00314 bool isBytecodeFile() const; 00315 00316 /// This function determines if the path name in the object references a 00317 /// native Dynamic Library (shared library, shared object) by looking at 00318 /// the file's magic number. The Path object must reference a file, not a 00319 /// directory. 00320 /// @return strue if the file starts with the magid number for a native 00321 /// shared library. 00322 /// @brief Determine if the path reference a dynamic library. 00323 bool isDynamicLibrary() const; 00324 00325 /// This function determines if the path name references an existing file 00326 /// or directory in the file system. 00327 /// @returns true if the pathname references an existing file or 00328 /// directory. 00329 /// @brief Determines if the path is a file or directory in 00330 /// the file system. 00331 bool exists() const; 00332 00333 /// This function determines if the path name references a readable file 00334 /// or directory in the file system. This function checks for 00335 /// the existence and readability (by the current program) of the file 00336 /// or directory. 00337 /// @returns true if the pathname references a readable file. 00338 /// @brief Determines if the path is a readable file or directory 00339 /// in the file system. 00340 bool canRead() const; 00341 00342 /// This function determines if the path name references a writable file 00343 /// or directory in the file system. This function checks for the 00344 /// existence and writability (by the current program) of the file or 00345 /// directory. 00346 /// @returns true if the pathname references a writable file. 00347 /// @brief Determines if the path is a writable file or directory 00348 /// in the file system. 00349 bool canWrite() const; 00350 00351 /// This function determines if the path name references an executable 00352 /// file in the file system. This function checks for the existence and 00353 /// executability (by the current program) of the file. 00354 /// @returns true if the pathname references an executable file. 00355 /// @brief Determines if the path is an executable file in the file 00356 /// system. 00357 bool canExecute() const; 00358 00359 /// This function builds a list of paths that are the names of the 00360 /// files and directories in a directory. 00361 /// @returns false if \p this is not a directory, true otherwise 00362 /// @throws std::string if the directory cannot be searched 00363 /// @brief Build a list of directory's contents. 00364 bool getDirectoryContents(std::set<Path>& paths) const; 00365 00366 /// This function returns status information about the file. The type of 00367 /// path (file or directory) is updated to reflect the actual contents 00368 /// of the file system. If the file does not exist, false is returned. 00369 /// For other (hard I/O) errors, a std::string is thrown indicating the 00370 /// problem. 00371 /// @throws std::string if an error occurs. 00372 /// @brief Get file status. 00373 void getStatusInfo(StatusInfo& info) const; 00374 00375 /// This function returns the last modified time stamp for the file 00376 /// referenced by this path. The Path may reference a file or a directory. 00377 /// If the file does not exist, a ZeroTime timestamp is returned. 00378 /// @returns last modified timestamp of the file/directory or ZeroTime 00379 /// @brief Get file timestamp. 00380 inline TimeValue getTimestamp() const { 00381 StatusInfo info; getStatusInfo(info); return info.modTime; 00382 } 00383 00384 /// This function returns the size of the file referenced by this path. 00385 /// @brief Get file size. 00386 inline size_t getSize() const { 00387 StatusInfo info; getStatusInfo(info); return info.fileSize; 00388 } 00389 00390 /// @} 00391 /// @name Path Mutators 00392 /// @{ 00393 public: 00394 /// The path name is cleared and becomes empty. This is an invalid 00395 /// path name but is the *only* invalid path name. This is provided 00396 /// so that path objects can be used to indicate the lack of a 00397 /// valid path being found. 00398 /// @brief Make the path empty. 00399 void clear() { path.clear(); } 00400 00401 /// This method sets the Path object to \p unverified_path. This can fail 00402 /// if the \p unverified_path does not pass the syntactic checks of the 00403 /// isValid() method. If verification fails, the Path object remains 00404 /// unchanged and false is returned. Otherwise true is returned and the 00405 /// Path object takes on the path value of \p unverified_path 00406 /// @returns true if the path was set, false otherwise. 00407 /// @param unverified_path The path to be set in Path object. 00408 /// @brief Set a full path from a std::string 00409 bool set(const std::string& unverified_path); 00410 00411 /// One path component is removed from the Path. If only one component is 00412 /// present in the path, the Path object becomes empty. If the Path object 00413 /// is empty, no change is made. 00414 /// @returns false if the path component could not be removed. 00415 /// @brief Removes the last directory component of the Path. 00416 bool eraseComponent(); 00417 00418 /// The \p component is added to the end of the Path if it is a legal 00419 /// name for the operating system. A directory separator will be added if 00420 /// needed. 00421 /// @returns false if the path component could not be added. 00422 /// @brief Appends one path component to the Path. 00423 bool appendComponent( const std::string& component ); 00424 00425 /// A period and the \p suffix are appended to the end of the pathname. 00426 /// The precondition for this function is that the Path reference a file 00427 /// name (i.e. isFile() returns true). If the Path is not a file, no 00428 /// action is taken and the function returns false. If the path would 00429 /// become invalid for the host operating system, false is returned. 00430 /// @returns false if the suffix could not be added, true if it was. 00431 /// @brief Adds a period and the \p suffix to the end of the pathname. 00432 bool appendSuffix(const std::string& suffix); 00433 00434 /// The suffix of the filename is erased. The suffix begins with and 00435 /// includes the last . character in the filename after the last directory 00436 /// separator and extends until the end of the name. If no . character is 00437 /// after the last directory separator, then the file name is left 00438 /// unchanged (i.e. it was already without a suffix) but the function 00439 /// returns false. 00440 /// @returns false if there was no suffix to remove, true otherwise. 00441 /// @brief Remove the suffix from a path name. 00442 bool eraseSuffix(); 00443 00444 /// The current Path name is made unique in the file system. Upon return, 00445 /// the Path will have been changed to make a unique file in the file 00446 /// system or it will not have been changed if the current path name is 00447 /// already unique. 00448 /// @throws std::string if an unrecoverable error occurs. 00449 /// @brief Make the current path name unique in the file system. 00450 void makeUnique( bool reuse_current = true ); 00451 00452 /// @} 00453 /// @name Disk Mutators 00454 /// @{ 00455 public: 00456 /// This method attempts to make the file referenced by the Path object 00457 /// available for reading so that the canRead() method will return true. 00458 /// @brief Make the file readable; 00459 void makeReadableOnDisk(); 00460 00461 /// This method attempts to make the file referenced by the Path object 00462 /// available for writing so that the canWrite() method will return true. 00463 /// @brief Make the file writable; 00464 void makeWriteableOnDisk(); 00465 00466 /// This method attempts to make the file referenced by the Path object 00467 /// available for execution so that the canExecute() method will return 00468 /// true. 00469 /// @brief Make the file readable; 00470 void makeExecutableOnDisk(); 00471 00472 /// This method allows the last modified time stamp and permission bits 00473 /// to be set on the disk object referenced by the Path. 00474 /// @throws std::string if an error occurs. 00475 /// @returns true 00476 /// @brief Set the status information. 00477 bool setStatusInfoOnDisk(const StatusInfo& si) const; 00478 00479 /// This method attempts to create a directory in the file system with the 00480 /// same name as the Path object. The \p create_parents parameter controls 00481 /// whether intermediate directories are created or not. if \p 00482 /// create_parents is true, then an attempt will be made to create all 00483 /// intermediate directories, as needed. If \p create_parents is false, 00484 /// then only the final directory component of the Path name will be 00485 /// created. The created directory will have no entries. 00486 /// @returns false if the Path does not reference a directory, true 00487 /// otherwise. 00488 /// @param create_parents Determines whether non-existent directory 00489 /// components other than the last one (the "parents") are created or not. 00490 /// @throws std::string if an error occurs. 00491 /// @brief Create the directory this Path refers to. 00492 bool createDirectoryOnDisk( bool create_parents = false ); 00493 00494 /// This method attempts to create a file in the file system with the same 00495 /// name as the Path object. The intermediate directories must all exist 00496 /// at the time this method is called. Use createDirectoriesOnDisk to 00497 /// accomplish that. The created file will be empty upon return from this 00498 /// function. 00499 /// @returns false if the Path does not reference a file, true otherwise. 00500 /// @throws std::string if an error occurs. 00501 /// @brief Create the file this Path refers to. 00502 bool createFileOnDisk(); 00503 00504 /// This is like createFile except that it creates a temporary file. A 00505 /// unique temporary file name is generated based on the contents of 00506 /// \p this before the call. The new name is assigned to \p this and the 00507 /// file is created. Note that this will both change the Path object 00508 /// *and* create the corresponding file. This function will ensure that 00509 /// the newly generated temporary file name is unique in the file system. 00510 /// @param reuse_current When set to true, this parameter indicates that 00511 /// if the current file name does not exist then it will be used without 00512 /// modification. 00513 /// @returns true if successful, false if the file couldn't be created. 00514 /// @throws std::string if there is a hard error creating the temp file 00515 /// name. 00516 /// @brief Create a unique temporary file 00517 bool createTemporaryFileOnDisk(bool reuse_current = false); 00518 00519 /// This method renames the file referenced by \p this as \p newName. The 00520 /// file referenced by \p this must exist. The file referenced by 00521 /// \p newName does not need to exist. 00522 /// @returns true 00523 /// @throws std::string if there is an file system error. 00524 /// @brief Rename one file as another. 00525 bool renamePathOnDisk(const Path& newName); 00526 00527 /// This method attempts to destroy the file or directory named by the 00528 /// last component of the Path. If the Path refers to a directory and the 00529 /// \p destroy_contents is false, an attempt will be made to remove just 00530 /// the directory (the final Path component). If \p destroy_contents is 00531 /// true, an attempt will be made to remove the entire contents of the 00532 /// directory, recursively. If the Path refers to a file, the 00533 /// \p destroy_contents parameter is ignored. 00534 /// @param destroy_contents Indicates whether the contents of a destroyed 00535 /// directory should also be destroyed (recursively). 00536 /// @returns true if the file/directory was destroyed, false if the path 00537 /// refers to something that is neither a file nor a directory. 00538 /// @throws std::string if there is an error. 00539 /// @brief Removes the file or directory from the filesystem. 00540 bool eraseFromDisk( bool destroy_contents = false ) const; 00541 00542 /// @} 00543 /// @name Data 00544 /// @{ 00545 private: 00546 mutable std::string path; ///< Storage for the path name. 00547 00548 /// @} 00549 }; 00550 00551 /// This enumeration delineates the kinds of files that LLVM knows about. 00552 enum LLVMFileType { 00553 UnknownFileType = 0, ///< Unrecognized file 00554 BytecodeFileType = 1, ///< Uncompressed bytecode file 00555 CompressedBytecodeFileType = 2, ///< Compressed bytecode file 00556 ArchiveFileType = 3 ///< ar style archive file 00557 }; 00558 00559 /// This utility function allows any memory block to be examined in order 00560 /// to determine its file type. 00561 LLVMFileType IdentifyFileType(const char*magic, unsigned length); 00562 00563 /// This function can be used to copy the file specified by Src to the 00564 /// file specified by Dest. If an error occurs, Dest is removed. 00565 /// @throws std::string if an error opening or writing the files occurs. 00566 /// @brief Copy one file to another. 00567 void CopyFile(const Path& Dest, const Path& Src); 00568 } 00569 00570 inline std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath) { 00571 strm << aPath.toString(); 00572 return strm; 00573 } 00574 00575 } 00576 00577 #endif