Copyright © 2006 Mikko Rasa, Mikkosoft Productions
Distributed under the LGPL
*/
-#include <msp/strutils.h>
+#include <msp/strings/utils.h>
#include "path.h"
#include "utils.h"
{
unsigned slash=path.rfind(DIRCHAR);
unsigned start=(slash==string::npos)?0:slash+1;
- if(path.compare(start, string::npos, ".."))
+ if(!path.compare(start, string::npos, ".."))
{
// If the last component already is a .., add another
path+=DIRCHAR;
path.erase(slash, string::npos);
}
}
- else if(comp!=".")
+ else if(comp!="." || path.empty())
{
+ if(path==".")
+ path="";
if(path.size()>1 || (path.size()==1 && path[0]!=DIRCHAR))
path+=DIRCHAR;
path+=comp;