added get_file_name which extracts the file name from a path

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3780 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2004-11-26 15:26:49 +00:00
parent f570ee3d1d
commit c2c907b2bf
2 changed files with 7 additions and 0 deletions

View file

@ -530,3 +530,9 @@ string get_dir_name(const string& path) {
return path.substr(0, last_separator_pos);
}
string get_file_name(const string& path) {
string::size_type last_separator_pos = path.rfind(PLATFORM_PATH_SEPARATOR_C);
if (last_separator_pos == string::npos)
return path;
return path.substr(last_separator_pos + 1, string::npos);
}