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:
parent
f570ee3d1d
commit
c2c907b2bf
2 changed files with 7 additions and 0 deletions
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@ size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm);
|
|||
|
||||
std::string get_full_path(const std::string &path);
|
||||
std::string get_dir_name(const std::string& path);
|
||||
std::string get_file_name(const std::string& path);
|
||||
|
||||
#ifndef _WIN32
|
||||
char *CharPrev(const char *s, const char *p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue