For PR495:
[oota-llvm.git] / include / llvm / System / Path.h
1 //===- llvm/System/Path.h - Path Operating System Concept -------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by Reid Spencer and is distributed under the
6 // University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the llvm::sys::Path class.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef LLVM_SYSTEM_PATH_H
15 #define LLVM_SYSTEM_PATH_H
16
17 #include "llvm/System/TimeValue.h"
18 #include <set>
19 #include <string>
20 #include <vector>
21 #include <ostream>
22
23 namespace llvm {
24 namespace sys {
25
26   /// This class provides an abstraction for the path to a file or directory
27   /// in the operating system's filesystem and provides various basic operations
28   /// on it.  Note that this class only represents the name of a path to a file
29   /// or directory which may or may not be valid for a given machine's file
30   /// system. A Path ensures that the name it encapsulates is syntactical valid
31   /// for the operating system it is running on but does not ensure correctness
32   /// for any particular file system. A Path either references a file or a
33   /// directory and the distinction is consistently maintained. Most operations
34   /// on the class have invariants that require the Path object to be either a
35   /// file path or a directory path, but not both. Those operations will also
36   /// leave the object as either a file path or object path. There is exactly
37   /// one invalid Path which is the empty path. The class should never allow any
38   /// other syntactically invalid non-empty path name to be assigned. Empty
39   /// paths are required in order to indicate an error result. If the path is
40   /// empty, the isValid operation will return false. All operations will fail
41   /// if isValid is false. Operations that change the path will either return
42   /// false if it would cause a syntactically invalid path name (in which case
43   /// the Path object is left unchanged) or throw an std::string exception
44   /// indicating the error.
45   /// @since 1.4
46   /// @brief An abstraction for operating system paths.
47   class Path {
48     /// @name Types
49     /// @{
50     public:
51       /// This structure provides basic file system information about a file. It
52       /// is patterned after the stat(2) Unix operating system call but made
53       /// platform independent and eliminates many of the unix-specific fields.
54       /// However, to support llvm-ar, the mode, user, and group fields are
55       /// retained. These pertain to unix security and may not have a meaningful
56       /// value on non-Unix platforms. However, the fileSize and modTime fields
57       /// should always be applicabe on all platforms.  The structure is
58       /// filled in by the getStatusInfo method.
59       /// @brief File status structure
60       struct StatusInfo {
61         StatusInfo() : fileSize(0), modTime(0,0), mode(0777), user(999),
62                        group(999), isDir(false) { }
63         size_t      fileSize;   ///< Size of the file in bytes
64         TimeValue   modTime;    ///< Time of file's modification
65         uint32_t    mode;       ///< Mode of the file, if applicable
66         uint32_t    user;       ///< User ID of owner, if applicable
67         uint32_t    group;      ///< Group ID of owner, if applicable
68         bool        isDir;      ///< True if this is a directory.
69       };
70
71     /// @}
72     /// @name Constructors
73     /// @{
74     public:
75       /// Construct a path to the root directory of the file system. The root
76       /// directory is a top level directory above which there are no more
77       /// directories. For example, on UNIX, the root directory is /. On Windows
78       /// it is C:\. Other operating systems may have different notions of
79       /// what the root directory is.
80       /// @throws nothing
81       static Path GetRootDirectory();
82
83       /// Construct a path to a unique temporary directory that is created in
84       /// a "standard" place for the operating system. The directory is
85       /// guaranteed to be created on exit from this function. If the directory
86       /// cannot be created, the function will throw an exception.
87       /// @throws std::string indicating why the directory could not be created.
88       /// @brief Constrct a path to an new, unique, existing temporary
89       /// directory.
90       static Path GetTemporaryDirectory();
91
92       /// Construct a vector of sys::Path that contains the "standard" system
93       /// library paths suitable for linking into programs. This function *must*
94       /// return the value of LLVM_LIB_SEARCH_PATH as the first item in \p Paths
95       /// if that environment variable is set and it references a directory.
96       /// @throws nothing
97       /// @brief Construct a path to the first system library directory
98       static void GetSystemLibraryPaths(std::vector<sys::Path>& Paths);
99
100       /// Construct a vector of sys::Path that contains the "standard" bytecode
101       /// library paths suitable for linking into an llvm program. This function
102       /// *must* return the value of LLVM_LIB_SEARCH_PATH as well as the value
103       /// of LLVM_LIBDIR. It also must provide the System library paths as
104       /// returned by GetSystemLibraryPaths.
105       /// @see GetSystemLibraryPaths
106       /// @brief Construct a list of directories in which bytecode could be
107       /// found.
108       static void GetBytecodeLibraryPaths(std::vector<sys::Path>& Paths);
109
110       /// Find the path to a library using its short name. Use the system
111       /// dependent library paths to locate the library.
112       /// @brief Find a library.
113       static Path  FindLibrary(std::string& short_name);
114
115       /// Construct a path to the default LLVM configuration directory. The
116       /// implementation must ensure that this is a well-known (same on many
117       /// systems) directory in which llvm configuration files exist. For
118       /// example, on Unix, the /etc/llvm directory has been selected.
119       /// @throws nothing
120       /// @brief Construct a path to the default LLVM configuration directory
121       static Path GetLLVMDefaultConfigDir();
122
123       /// Construct a path to the LLVM installed configuration directory. The
124       /// implementation must ensure that this refers to the "etc" directory of
125       /// the LLVM installation. This is the location where configuration files
126       /// will be located for a particular installation of LLVM on a machine.
127       /// @throws nothing
128       /// @brief Construct a path to the LLVM installed configuration directory
129       static Path GetLLVMConfigDir();
130
131       /// Construct a path to the current user's home directory. The
132       /// implementation must use an operating system specific mechanism for
133       /// determining the user's home directory. For example, the environment
134       /// variable "HOME" could be used on Unix. If a given operating system
135       /// does not have the concept of a user's home directory, this static
136       /// constructor must provide the same result as GetRootDirectory.
137       /// @throws nothing
138       /// @brief Construct a path to the current user's "home" directory
139       static Path GetUserHomeDirectory();
140
141       /// Return the suffix commonly used on file names that contain a shared
142       /// object, shared archive, or dynamic link library. Such files are
143       /// linked at runtime into a process and their code images are shared
144       /// between processes.
145       /// @returns The dynamic link library suffix for the current platform.
146       /// @brief Return the dynamic link library suffix.
147       static std::string GetDLLSuffix();
148
149       /// This is one of the very few ways in which a path can be constructed
150       /// with a syntactically invalid name. The only *legal* invalid name is an
151       /// empty one. Other invalid names are not permitted. Empty paths are
152       /// provided so that they can be used to indicate null or error results in
153       /// other lib/System functionality.
154       /// @throws nothing
155       /// @brief Construct an empty (and invalid) path.
156       Path() : path() {}
157
158       /// This constructor will accept a std::string as a path but if verifies
159       /// that the path string has a legal syntax for the operating system on
160       /// which it is running. This allows a path to be taken in from outside
161       /// the program. However, if the path is not valid, the Path object will
162       /// be set to an empty string and an exception will be thrown.
163       /// @throws std::string if the path string is not legal.
164       /// @param unverified_path The path to verify and assign.
165       /// @brief Construct a Path from a string.
166       explicit Path(const std::string& unverified_path);
167
168     /// @}
169     /// @name Operators
170     /// @{
171     public:
172       /// Makes a copy of \p that to \p this.
173       /// @returns \p this
174       /// @throws nothing
175       /// @brief Assignment Operator
176       Path & operator = ( const Path & that ) {
177         path = that.path;
178         return *this;
179       }
180
181       /// Compares \p this Path with \p that Path for equality.
182       /// @returns true if \p this and \p that refer to the same thing.
183       /// @throws nothing
184       /// @brief Equality Operator
185       bool operator == (const Path& that) const {
186         return 0 == path.compare(that.path) ;
187       }
188
189       /// Compares \p this Path with \p that Path for inequality.
190       /// @returns true if \p this and \p that refer to different things.
191       /// @throws nothing
192       /// @brief Inequality Operator
193       bool operator !=( const Path & that ) const {
194         return 0 != path.compare( that.path );
195       }
196
197       /// Determines if \p this Path is less than \p that Path. This is required
198       /// so that Path objects can be placed into ordered collections (e.g.
199       /// std::map). The comparison is done lexicographically as defined by
200       /// the std::string::compare method.
201       /// @returns true if \p this path is lexicographically less than \p that.
202       /// @throws nothing
203       /// @brief Less Than Operator
204       bool operator< (const Path& that) const {
205         return 0 > path.compare( that.path );
206       }
207
208     /// @}
209     /// @name Accessors
210     /// @{
211     public:
212       /// This function will use an operating system specific algorithm to
213       /// determine if the current value of \p this is a syntactically valid
214       /// path name for the operating system. The path name does not need to
215       /// exist, validity is simply syntactical. Empty paths are always invalid.
216       /// @returns true iff the path name is syntactically legal for the
217       /// host operating system.
218       /// @brief Determine if a path is syntactically valid or not.
219       bool isValid() const;
220
221       /// This function determines if the contents of the path name are
222       /// empty. That is, the path has a zero length.
223       /// @returns true iff the path is empty.
224       /// @brief Determines if the path name is empty (invalid).
225       bool isEmpty() const { return path.empty(); }
226
227       /// This function determines if the path name in this object is intended
228       /// to reference a legal file name (as opposed to a directory name). This
229       /// function does not verify anything with the file system, it merely
230       /// determines if the syntax of the path represents a file name or not.
231       /// @returns true if this path name references a file.
232       /// @brief Determines if the path name references a file.
233       bool isFile() const;
234
235       /// This function determines if the path name in this object is intended
236       /// to reference a legal directory name (as opposed to a file name). This
237       /// function does not verify anything with the file system, it merely
238       /// determines if the syntax of the path represents a directory name or
239       /// not.
240       /// @returns true if the path name references a directory
241       /// @brief Determines if the path name references a directory.
242       bool isDirectory() const;
243
244       /// This function determines if the path refers to a hidden file. The
245       /// notion of hidden files is defined by  the underlying system. The
246       /// system may not support hidden files in which case this function always
247       /// returns false on such systems. Hidden files have the "hidden"
248       /// attribute set on Win32. On Unix, hidden files start with a period.
249       /// @brief Determines if the path name references a hidden file.
250       bool isHidden() const;
251
252       /// This function determines if the path name in this object references
253       /// the root (top level directory) of the file system. The details of what
254       /// is considered the "root" may vary from system to system so this method
255       /// will do the necessary checking.
256       /// @returns true iff the path name references the root directory.
257       /// @brief Determines if the path references the root directory.
258       bool isRootDirectory() const;
259
260       /// This function opens the file associated with the path name provided by
261       /// the Path object and reads its magic number. If the magic number at the
262       /// start of the file matches \p magic, true is returned. In all other
263       /// cases (file not found, file not accessible, etc.) it returns false.
264       /// @returns true if the magic number of the file matches \p magic.
265       /// @brief Determine if file has a specific magic number
266       bool hasMagicNumber(const std::string& magic) const;
267
268       /// This function retrieves the first \p len bytes of the file associated
269       /// with \p this. These bytes are returned as the "magic number" in the
270       /// \p Magic parameter.
271       /// @returns true if the Path is a file and the magic number is retrieved,
272       /// false otherwise.
273       /// @brief Get the file's magic number.
274       bool getMagicNumber(std::string& Magic, unsigned len) const;
275
276       /// This function determines if the path name in the object references an
277       /// archive file by looking at its magic number.
278       /// @returns true if the file starts with the magic number for an archive
279       /// file.
280       /// @brief Determine if the path references an archive file.
281       bool isArchive() const;
282
283       /// This function determines if the path name in the object references an
284       /// LLVM Bytecode file by looking at its magic number.
285       /// @returns true if the file starts with the magic number for LLVM
286       /// bytecode files.
287       /// @brief Determine if the path references a bytecode file.
288       bool isBytecodeFile() const;
289
290       /// This function determines if the path name in the object references a
291       /// native Dynamic Library (shared library, shared object) by looking at
292       /// the file's magic number. The Path object must reference a file, not a
293       /// directory.
294       /// @return strue if the file starts with the magid number for a native
295       /// shared library.
296       /// @brief Determine if the path reference a dynamic library.
297       bool isDynamicLibrary() const;
298
299       /// This function determines if the path name references an existing file
300       /// or directory in the file system. Unlike isFile and isDirectory, this
301       /// function actually checks for the existence of the file or directory.
302       /// @returns true if the pathname references an existing file.
303       /// @brief Determines if the path is a file or directory in
304       /// the file system.
305       bool exists() const;
306
307       /// This function determines if the path name references a readable file
308       /// or directory in the file system. Unlike isFile and isDirectory, this
309       /// function actually checks for the existence and readability (by the
310       /// current program) of the file or directory.
311       /// @returns true if the pathname references a readable file.
312       /// @brief Determines if the path is a readable file or directory
313       /// in the file system.
314       bool canRead() const;
315
316       /// This function determines if the path name references a writable file
317       /// or directory in the file system. Unlike isFile and isDirectory, this
318       /// function actually checks for the existence and writability (by the
319       /// current program) of the file or directory.
320       /// @returns true if the pathname references a writable file.
321       /// @brief Determines if the path is a writable file or directory
322       /// in the file system.
323       bool canWrite() const;
324
325       /// This function determines if the path name references an executable
326       /// file in the file system. Unlike isFile and isDirectory, this
327       /// function actually checks for the existence and executability (by
328       /// the current program) of the file.
329       /// @returns true if the pathname references an executable file.
330       /// @brief Determines if the path is an executable file in the file
331       /// system.
332       bool canExecute() const;
333
334       /// This function returns the current contents of the path as a
335       /// std::string. This allows the underlying path string to be manipulated
336       /// by other software.
337       /// @returns std::string containing the path name.
338       /// @brief Returns the path as a std::string.
339       const std::string& toString() const { return path; }
340
341       /// This function returns the last component of the path name. If the
342       /// isDirectory() function would return true then this returns the name
343       /// of the last directory in the path. If the isFile() function would
344       /// return true then this function returns the name of the file without
345       /// any of the preceding directories.
346       /// @returns std::string containing the last component of the path name.
347       /// @brief Returns the last component of the path name.
348       std::string getLast() const;
349
350       /// This function strips off the path and suffix of the file name and
351       /// returns just the basename.
352       /// @returns std::string containing the basename of the path
353       /// @throws nothing
354       /// @brief Get the base name of the path
355       std::string getBasename() const;
356
357       /// This function builds a list of paths that are the names of the
358       /// files and directories in a directory.
359       /// @returns false if \p this is not a directory, true otherwise
360       /// @throws std::string if the directory cannot be searched
361       /// @brief Build a list of directory's contents.
362       bool getDirectoryContents(std::set<Path>& paths) const;
363
364       /// This method attempts to destroy the directory named by the last in
365       /// the Path name.  If \p remove_contents is false, an attempt will be
366       /// made to remove just the directory that this Path object refers to
367       /// (the final Path component). If \p remove_contents is true, an attempt
368       /// will be made to remove the entire contents of the directory,
369       /// recursively.
370       /// @param destroy_contents Indicates whether the contents of a destroyed
371       /// directory should also be destroyed (recursively).
372       /// @returns false if the Path does not refer to a directory, true
373       /// otherwise.
374       /// @throws std::string if there is an error.
375       /// @brief Removes the file or directory from the filesystem.
376       bool destroyDirectory( bool destroy_contents = false ) const;
377
378       /// This method attempts to destroy the file named by the last item in the
379       /// Path name.
380       /// @returns false if the Path does not refer to a file, true otherwise.
381       /// @throws std::string if there is an error.
382       /// @brief Destroy the file this Path refers to.
383       bool destroyFile() const;
384
385       /// Obtain a 'C' string for the path name.
386       /// @returns a 'C' string containing the path name.
387       /// @brief Returns the path as a C string.
388       const char* const c_str() const { return path.c_str(); }
389
390     /// @}
391     /// @name Mutators
392     /// @{
393     public:
394       /// The path name is cleared and becomes empty. This is an invalid
395       /// path name but is the *only* invalid path name. This is provided
396       /// so that path objects can be used to indicate the lack of a
397       /// valid path being found.
398       void clear() { path.clear(); }
399
400       /// This function returns status information about the file. The type of
401       /// path (file or directory) is updated to reflect the actual contents
402       /// of the file system. If the file does not exist, false is returned.
403       /// For other (hard I/O) errors, a std::string is throwing indicating the
404       /// problem.
405       /// @throws std::string if an error occurs.
406       /// @brief Get file status.
407       void getStatusInfo(StatusInfo& info) const;
408
409       /// This function returns the last modified time stamp for the file
410       /// referenced by this path. The Path may reference a file or a directory.
411       /// If the file does not exist, a ZeroTime timestamp is returned.
412       /// @returns last modified timestamp of the file/directory or ZeroTime
413       /// @brief Get file timestamp.
414       inline TimeValue getTimestamp() const {
415         StatusInfo info; getStatusInfo(info); return info.modTime;
416       }
417
418       /// This function returns the size of the file referenced by this path.
419       /// @brief Get file size.
420       inline size_t getSize() const {
421         StatusInfo info; getStatusInfo(info); return info.fileSize;
422       }
423
424       /// This method attempts to make the file referenced by the Path object
425       /// available for reading so that the readable() method will return true.
426       /// @brief Make the file readable;
427       void makeReadable();
428
429       /// This method attempts to make the file referenced by the Path object
430       /// available for writing so that the writable() method will return true.
431       /// @brief Make the file writable;
432       void makeWriteable();
433
434       /// This method attempts to make the file referenced by the Path object
435       /// available for execution so that the executable() method will return
436       /// true.
437       /// @brief Make the file readable;
438       void makeExecutable();
439
440       /// This method attempts to set the Path object to \p unverified_path
441       /// and interpret the name as a directory name.  The \p unverified_path
442       /// is verified. If verification succeeds then \p unverified_path
443       /// is accepted as a directory and true is returned. Otherwise,
444       /// the Path object remains unchanged and false is returned.
445       /// @returns true if the path was set, false otherwise.
446       /// @param unverified_path The path to be set in Path object.
447       /// @throws nothing
448       /// @brief Set a full path from a std::string
449       bool setDirectory(const std::string& unverified_path);
450
451       /// This method attempts to set the Path object to \p unverified_path
452       /// and interpret the name as a file name.  The \p unverified_path
453       /// is verified. If verification succeeds then \p unverified_path
454       /// is accepted as a file name and true is returned. Otherwise,
455       /// the Path object remains unchanged and false is returned.
456       /// @returns true if the path was set, false otherwise.
457       /// @param unverified_path The path to be set in Path object.
458       /// @throws nothing
459       /// @brief Set a full path from a std::string
460       bool setFile(const std::string& unverified_path);
461
462       /// The \p dirname is added to the end of the Path if it is a legal
463       /// directory name for the operating system. The precondition for this
464       /// function is that the Path must reference a directory name (i.e.
465       /// isDirectory() returns true).
466       /// @param dirname A string providing the directory name to
467       /// be added to the end of the path.
468       /// @returns false if the directory name could not be added
469       /// @throws nothing
470       /// @brief Adds the name of a directory to a Path.
471       bool appendDirectory( const std::string& dirname );
472
473       /// One directory component is removed from the Path name. The Path must
474       /// refer to a non-root directory name (i.e. isDirectory() returns true
475       /// but isRootDirectory() returns false). Upon exit, the Path will
476       /// refer to the directory above it.
477       /// @throws nothing
478       /// @returns false if the directory name could not be removed.
479       /// @brief Removes the last directory component of the Path.
480       bool elideDirectory();
481
482       /// The \p filename is added to the end of the Path if it is a legal
483       /// directory name for the operating system. The precondition for this
484       /// function is that the Path reference a directory name (i.e.
485       /// isDirectory() returns true).
486       /// @throws nothing
487       /// @returns false if the file name could not be added.
488       /// @brief Appends the name of a file.
489       bool appendFile( const std::string& filename );
490
491       /// One file component is removed from the Path name. The Path must
492       /// refer to a file (i.e. isFile() returns true). Upon exit,
493       /// the Path will refer to the directory above it.
494       /// @throws nothing
495       /// @returns false if the file name could not be removed
496       /// @brief Removes the last file component of the path.
497       bool elideFile();
498
499       /// A period and the \p suffix are appended to the end of the pathname.
500       /// The precondition for this function is that the Path reference a file
501       /// name (i.e. isFile() returns true). If the Path is not a file, no
502       /// action is taken and the function returns false. If the path would
503       /// become invalid for the host operating system, false is returned.
504       /// @returns false if the suffix could not be added, true if it was.
505       /// @throws nothing
506       /// @brief Adds a period and the \p suffix to the end of the pathname.
507       bool appendSuffix(const std::string& suffix);
508
509       /// The suffix of the filename is removed. The suffix begins with and
510       /// includes the last . character in the filename after the last directory
511       /// separator and extends until the end of the name. If no . character is
512       /// after the last directory separator, then the file name is left
513       /// unchanged (i.e. it was already without a suffix) but the function
514       /// returns false.
515       /// @returns false if there was no suffix to remove, true otherwise.
516       /// @throws nothing
517       /// @brief Remove the suffix from a path name.
518       bool elideSuffix();
519
520       /// The current Path name is made unique in the file system. Upon return,
521       /// the Path will have been changed to make a unique file in the file
522       /// system or it will not have been changed if the current path name is
523       /// already unique.
524       /// @throws std::string if an unrecoverable error occurs.
525       /// @brief Make the current path name unique in the file system.
526       void makeUnique( bool reuse_current = true );
527
528       /// This method attempts to create a directory in the file system with the
529       /// same name as the Path object. The \p create_parents parameter controls
530       /// whether intermediate directories are created or not. if \p
531       /// create_parents is true, then an attempt will be made to create all
532       /// intermediate directories. If \p create_parents is false, then only the
533       /// final directory component of the Path name will be created. The
534       /// created directory will have no entries.
535       /// @returns false if the Path does not reference a directory, true
536       /// otherwise.
537       /// @param create_parents Determines whether non-existent directory
538       /// components other than the last one (the "parents") are created or not.
539       /// @throws std::string if an error occurs.
540       /// @brief Create the directory this Path refers to.
541       bool createDirectory( bool create_parents = false );
542
543       /// This method attempts to create a file in the file system with the same
544       /// name as the Path object. The intermediate directories must all exist
545       /// at the time this method is called. Use createDirectories to
546       /// accomplish that. The created file will be empty upon return from this
547       /// function.
548       /// @returns false if the Path does not reference a file, true otherwise.
549       /// @throws std::string if an error occurs.
550       /// @brief Create the file this Path refers to.
551       bool createFile();
552
553       /// This is like createFile except that it creates a temporary file. A
554       /// unique temporary file name is generated based on the contents of
555       /// \p this before the call. The new name is assigned to \p this and the
556       /// file is created.  Note that this will both change the Path object
557       /// *and* create the corresponding file. This function will ensure that
558       /// the newly generated temporary file name is unique in the file system.
559       /// @throws std::string if there is an error
560       /// @brief Create a unique temporary file
561       bool createTemporaryFile(bool reuse_current = false);
562
563
564       /// This method renames the file referenced by \p this as \p newName. Both
565       /// files must exist before making this call.
566       /// @returns false if the Path does not refer to a file, true otherwise.
567       /// @throws std::string if there is an file system error.
568       /// @brief Rename one file as another.
569       bool renameFile(const Path& newName);
570
571       /// This method sets the access time, modification time, and permission
572       /// mode of the file associated with \p this as given by \p si.
573       /// @returns false if the Path does not refer to a file, true otherwise.
574       /// @throws std::string if the file could not be modified
575       /// @brief Set file times and mode.
576       bool setStatusInfo(const StatusInfo& si ) const ;
577
578     /// @}
579     /// @name Data
580     /// @{
581     private:
582         mutable std::string path;   ///< Storage for the path name.
583
584     /// @}
585   };
586
587   /// This enumeration delineates the kinds of files that LLVM knows about.
588   enum LLVMFileType {
589     UnknownFileType = 0,            ///< Unrecognized file
590     BytecodeFileType = 1,           ///< Uncompressed bytecode file
591     CompressedBytecodeFileType = 2, ///< Compressed bytecode file
592     ArchiveFileType = 3,            ///< ar style archive file
593   };
594
595   /// This utility function allows any memory block to be examined in order
596   /// to determine its file type.
597   LLVMFileType IdentifyFileType(const char*magic, unsigned length);
598
599   /// This function can be used to copy the file specified by Src to the
600   /// file specified by Dest. If an error occurs, Dest is removed.
601   /// @throws std::string if an error opening or writing the files occurs.
602   /// @brief Copy one file to another.
603   void CopyFile(const Path& Dest, const Path& Src);
604 }
605
606 inline std::ostream& operator<<(std::ostream& strm, const sys::Path& aPath) {
607   strm << aPath.toString();
608   return strm;
609 }
610
611 }
612
613
614 #endif