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:
Bryan Schumaker 2012-03-08 20:16:23 -05:00
parent 933fc308e6
commit 9aeae532d3
1 changed files with 3 additions and 9 deletions

View File

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