Brian Carlstrom | db4d540 | 2011-08-09 12:18:28 -0700 | [diff] [blame] | 1 | // Copyright 2009 Google Inc. All Rights Reserved. |
| 2 | |
| 3 | #ifndef ART_SRC_OS_H_ |
| 4 | #define ART_SRC_OS_H_ |
| 5 | |
| 6 | namespace art { |
| 7 | |
| 8 | // Interface to the underlying OS platform. |
| 9 | |
| 10 | class File; |
| 11 | |
| 12 | class OS { |
| 13 | public: |
| 14 | |
| 15 | // Open a file. The returned file must be deleted by the caller. |
Brian Carlstrom | 4e777d4 | 2011-08-15 13:53:52 -0700 | [diff] [blame] | 16 | static File* OpenFile(const char* name, bool writable); |
Brian Carlstrom | db4d540 | 2011-08-09 12:18:28 -0700 | [diff] [blame] | 17 | |
| 18 | // Create a file from an already open file descriptor |
| 19 | static File* FileFromFd(const char* name, int fd); |
| 20 | |
| 21 | // Check if a file exists. |
| 22 | static bool FileExists(const char* name); |
Brian Carlstrom | 1619286 | 2011-09-12 17:50:06 -0700 | [diff] [blame] | 23 | |
| 24 | // Check if a directory exists. |
| 25 | static bool DirectoryExists(const char* name); |
Brian Carlstrom | db4d540 | 2011-08-09 12:18:28 -0700 | [diff] [blame] | 26 | }; |
| 27 | |
| 28 | } // namespace art |
| 29 | |
| 30 | #endif // ART_SRC_OS_H_ |