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