Esempio n. 1
0
 public static void RMDir(IDir self, String unixPath) {
     if (unixPath == null) {
         self.RMDirMe();
         return;
     }
     if (unixPath.StartsWith("/")) {
         RMDir(TravUt.GetRoot(self), unixPath.Substring(1));
         return;
     }
     int p = unixPath.IndexOf('/');
     String s1 = (p < 0) ? unixPath : unixPath.Substring(0, p);
     String s2 = (p < 0) ? null : unixPath.Substring(1 + p);
     if (s1 == ".") {
         RMDir(self, s2);
         return;
     }
     if (s1 == "..") {
         RMDir(self.ParentDir, s2);
         return;
     }
     IEnt o = self.FindReal(s1);
     if (o is IDir) {
         RMDir((IDir)o, s2);
         return;
     }
     else if (o != null) {
         throw new RmdException("We knew \"" + o.Name + "\" is a file.");
     }
     throw new RmdException("We can't remove \"" + unixPath + "\".");
 }