public static Stream Createf(IDir self, String unixPath, ConDyn cd) { if (unixPath == null) throw new StorException("unixPath is null"); if (unixPath.StartsWith("/")) { return Createf(GetRoot(self), unixPath.Substring(1), cd); } int p = unixPath.IndexOf('/'); String s1 = (p < 0) ? unixPath : unixPath.Substring(0, p); String s2 = (p < 0) ? null : unixPath.Substring(1 + p); if (s1 == ".") { return Createf(self, s2, cd); } if (s1 == "..") { return Createf(self.ParentDir, s2, cd); } if (s2 == null) { MacfNam m2 = cd.ParseName(s1); try { self.CreatefHere(m2.Name); } catch (DSIException err) { if (err.ErrorCode == (int)AFPt2.DSIException.ResultCode.kFPObjectExists) { } else throw new StorException("Failed", err); } IEnt o2 = self.FindReal(m2.Name); if (false) { } else if (m2.Ty == Forkty.Data && o2 is ICanUP) return ((ICanUP)o2).OpenWrite(false); else if (m2.Ty == Forkty.Res && o2 is ICanUP) return ((ICanUP)o2).OpenWrite(true); else if (m2.Ty == Forkty.Finder && o2 is ICanUPFi) return ((ICanUPFi)o2).OpenWriteFinder(); else throw new StorException("We can't write to \"" + o2.Name + "\"."); } IEnt o = self.FindReal(s1); if (o is IDir) { return Createf((IDir)o, s2, cd); } else if (o != null) { throw new StorException("We knew \"" + o.Name + "\" is a file."); } throw new StorException("We can't be here for \"" + o.Name + "\"."); }