blob: d22b451b414f57563d622c45b53f15c985fb8e4a [file] [log] [blame]
Po-Hsien Wanga956e652020-11-11 16:29:04 -08001// 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
10class 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;
Po-Hsien Wang53230a22020-11-12 18:03:18 -080020 const char* c_str() const;
Po-Hsien Wanga956e652020-11-11 16:29:04 -080021 bool IsSeparator(char character);
22 FilePath Append(const FilePath& path);
23 void StripTrailingSeparatorsInternal();
24
25 private:
26 std::string path_;
27 char kStringTerminator = '\0';
28 char kSeparators[2] = "/";
29 char kCurrentDirectory[2] = ".";
30};
31bool CreateDirectory(FilePath&);
32std::string::size_type FindDriveLetter(std::string path);
33
34#endif // BENCH_GL_FILES_PATH_H_