- Filename result;
- unsigned dot=fn.rfind('.');
- result.base=fn.substr(0,dot);
- if(dot!=string::npos)
- result.ext=fn.substr(dot);
+ if(::unlink(path.str().c_str())==-1)
+ throw SystemError("unlink failed", errno);
+}
+
+Path relative(const Path &path, const Path &base)
+{
+ Path::Iterator i = path.begin();
+ Path::Iterator j = base.begin();
+ for(; (i!=path.end() && j!=base.end() && *i==*j); ++i, ++j) ;
+
+ Path result;
+ for(; j!=base.end(); ++j)
+ result /= "..";
+ for(; i!=path.end(); ++i)
+ result /= *i;
+