Po-Hsien Wang | a956e65 | 2020-11-11 16:29:04 -0800 | [diff] [blame] | 1 | // Copyright 2020 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef BENCH_GL_FILES_PATH_H_ |
| 6 | #define BENCH_GL_FILES_PATH_H_ |
| 7 | |
| 8 | #include <iostream> |
| 9 | |
| 10 | class FilePath { |
| 11 | public: |
| 12 | FilePath() { this->path_ = std::string(""); } |
| 13 | FilePath(const FilePath& that) { this->path_ = that.path_; } |
| 14 | FilePath(std::string path) { this->path_ = path; } |
| 15 | FilePath(const char* path) { this->path_ = path; } |
| 16 | ~FilePath() = default; |
| 17 | |
| 18 | FilePath DirName(); |
| 19 | const std::string& value() const; |
| 20 | bool IsSeparator(char character); |
| 21 | FilePath Append(const FilePath& path); |
| 22 | void StripTrailingSeparatorsInternal(); |
| 23 | |
| 24 | private: |
| 25 | std::string path_; |
| 26 | char kStringTerminator = '\0'; |
| 27 | char kSeparators[2] = "/"; |
| 28 | char kCurrentDirectory[2] = "."; |
| 29 | }; |
| 30 | bool CreateDirectory(FilePath&); |
| 31 | std::string::size_type FindDriveLetter(std::string path); |
| 32 | |
| 33 | #endif // BENCH_GL_FILES_PATH_H_ |