13 std::replace(path_.begin(), path_.end(),
'\\',
'/');
14 auto pos = path_.rfind(
'/');
15 base_ = (pos != std::string::npos) ? path_.substr(0, pos) :
".";
16 file_ = (pos != std::string::npos) ? path_.substr(pos + 1) : path_;
19 const std::string& path()
const {
return path_; }
20 const std::string& base_name()
const {
return base_; }
21 const std::string& file_name()
const {
return file_; }
23 std::string extension()
const {
24 auto pos = file_.rfind(
'.');
25 return (pos != std::string::npos) ? file_.substr(pos + 1) : std::string();
28 std::string remove_extension()
const {
29 auto pos = file_.rfind(
'.');
30 return (pos != std::string::npos) ? file_.substr(0, pos) : file_;
33 operator const std::string& ()
const {
Represents a path in the file system.
Definition: file_path.h:8