Moved removeFile() and getUniqueFilename() into FileUtilities.
[oota-llvm.git] / include / llvm / Support / FileUtilities.h
1 //===- Support/FileUtilities.h - File System Utilities ----------*- C++ -*-===//
2 //
3 // This file defines a family of utility functions which are useful for doing
4 // various things with files.
5 //
6 //===----------------------------------------------------------------------===//
7
8 #ifndef SUPPORT_FILEUTILITIES_H
9 #define SUPPORT_FILEUTILITIES_H
10
11 #include <string>
12
13 /// DiffFiles - Compare the two files specified, returning true if they are
14 /// different or if there is a file error.  If you specify a string to fill in
15 /// for the error option, it will set the string to an error message if an error
16 /// occurs, allowing the caller to distinguish between a failed diff and a file
17 /// system error.
18 ///
19 bool DiffFiles(const std::string &FileA, const std::string &FileB,
20                std::string *Error = 0);
21
22
23 /// MoveFileOverIfUpdated - If the file specified by New is different than Old,
24 /// or if Old does not exist, move the New file over the Old file.  Otherwise,
25 /// remove the New file.
26 ///
27 void MoveFileOverIfUpdated(const std::string &New, const std::string &Old);
28  
29 /// removeFile - Delete the specified file
30 ///
31 void removeFile(const std::string &Filename);
32
33 /// getUniqueFilename - Return a filename with the specified prefix.  If the
34 /// file does not exist yet, return it, otherwise add a suffix to make it
35 /// unique.
36 ///
37 std::string getUniqueFilename(const std::string &FilenameBase);
38
39 #endif