1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-07 06:41:38 +00:00

ttvfs update

This commit is contained in:
fgenesis 2014-04-15 15:04:33 +02:00
commit 3cf3ac7659
13 changed files with 220 additions and 120 deletions

View file

@ -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;
}