mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-07 06:41:38 +00:00
ttvfs update
This commit is contained in:
parent
87bc46abf6
commit
3cf3ac7659
13 changed files with 220 additions and 120 deletions
|
@ -317,8 +317,10 @@ void FixPath(std::string& s)
|
|||
s.clear();
|
||||
return;
|
||||
}
|
||||
if(s.c_str() != p)
|
||||
s = p;
|
||||
size_t len = s.length();
|
||||
while(len)
|
||||
while(len > 1) // remove all trailing slashes unless the first char is a slash -- leave it there for absolute unix paths
|
||||
{
|
||||
char end = s[len - 1];
|
||||
if(end == '/' || end == '\\') // strip trailing '/'
|
||||
|
@ -354,9 +356,12 @@ void MakeSlashTerminated(std::string& s)
|
|||
s += '/';
|
||||
}
|
||||
|
||||
// extracts the file name from a given path
|
||||
// extracts the file name (part after the last /) from a given path
|
||||
// returns the string "/" as-is.
|
||||
const char *GetBaseNameFromPath(const char *str)
|
||||
{
|
||||
if(str[0] == '/' && !str[1])
|
||||
return str;
|
||||
const char *p = strrchr(str, '/');
|
||||
return p ? p+1 : str;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue