void shapePath (ustring& path) {
static uregex re1 ("//+");
static uregex re2 ("[^/]+/\\.\\.(/|$)");
+ static uregex re3 ("(/|^)\\.(/|$)");
umatch m;
uiterator b, e;
path = ustring (b, m[0].first).append (m[0].second, e);
}
}
+ while (usearch (path, m, re3)) {
+ switch (m[0].second - m[0].first) {
+ case 1:
+ goto Bp1;
+ case 2:
+ b = path.begin ();
+ e = path.end ();
+ path = ustring (b, m[0].first).append (m[0].second, e);
+ break;
+ case 3:
+ b = path.begin ();
+ e = path.end ();
+ path = ustring (b, m[0].first).append (m[2].first, e);
+ break;
+ default:;
+ assert (0);
+ }
+ }
+ Bp1:;
}
bool isAbsolutePath (const ustring& path) {