Skip to content

Commit

Permalink
Fix path stem and add filename
Browse files Browse the repository at this point in the history
  • Loading branch information
tmigimatsu committed Aug 3, 2019
1 parent cb3b1f7 commit 661ad23
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion include/ctrl_utils/filesystem.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,15 @@ class path {
if (idx_start == idx_end) {
return str_.substr(idx_start);
} else {
return str_.substr(idx_start, idx_end);
return str_.substr(idx_start, idx_end - idx_start);
}
}

path filename() const {
const size_t idx_start = str_.find_last_of("/\\") + 1;
return str_.substr(idx_start);
}

bool operator==(const path& other) const { return str_ == other.str_; }

private:
Expand Down

0 comments on commit 661ad23

Please sign in to comment.