Ocarina: Set path prefix better
The string class already has functions for what I need, so I might as well use them... Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
parent
933fc308e6
commit
9aeae532d3
|
@ -20,15 +20,9 @@ static string path_prefix;
|
|||
|
||||
void set_path_prefix(string prefix)
|
||||
{
|
||||
unsigned int stop = 0;
|
||||
|
||||
for (stop = prefix.size() - 1; stop > 0; stop--) {
|
||||
if (prefix[stop] == '/')
|
||||
break;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < stop; i++)
|
||||
path_prefix += prefix[i];
|
||||
unsigned int found = prefix.rfind("/");
|
||||
if (found != string::npos)
|
||||
path_prefix = prefix.substr(0, found);
|
||||
println("Path prefix: " + path_prefix);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue