Changeset 1424
- Timestamp:
- Dec 16, 2011, 4:41:23 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/utility.cc
r1423 r1424 128 128 std::string file_name(const std::string& full_path) 129 129 { 130 std::stringstream ss(full_path); 131 std::string name; 132 while (getline(ss,name,'/')) {} 133 return name; 130 if (full_path.size()<2) 131 return full_path; 132 // exclude last char from search 133 size_t pos = full_path.find_last_of('/', full_path.size()-2); 134 if (pos==std::string::npos) 135 return full_path; 136 return full_path.substr(pos+1); 134 137 } 135 138
Note: See TracChangeset
for help on using the changeset viewer.