void SetShareLeafName(String shareLeafName) { if (PlatformPath.IsValidUnixFileName(shareLeafName)) { this.shareLeafName = shareLeafName; } else { String newShareLeafName = NfsPath.LeafName(shareLeafName); if (!PlatformPath.IsValidUnixFileName(newShareLeafName)) { throw new InvalidOperationException(String.Format("The file you supplied '{0}' is not a valid unix file name", shareLeafName)); } this.shareLeafName = newShareLeafName; } }
public void TestLeafName() { Assert.AreEqual(null, NfsPath.LeafName(null)); Assert.AreEqual(null, NfsPath.LeafName("")); Assert.AreEqual(null, NfsPath.LeafName("/")); Assert.AreEqual("a", NfsPath.LeafName("a")); Assert.AreEqual("a", NfsPath.LeafName("/a")); Assert.AreEqual("a", NfsPath.LeafName("a/")); Assert.AreEqual("a", NfsPath.LeafName("/a/")); Assert.AreEqual("leafname", NfsPath.LeafName("leafname")); Assert.AreEqual("leafname", NfsPath.LeafName("/leafname")); Assert.AreEqual("leafname", NfsPath.LeafName("leafname/")); Assert.AreEqual("leafname", NfsPath.LeafName("/leafname/")); Assert.AreEqual("a", NfsPath.LeafName("leafname/a")); Assert.AreEqual("a", NfsPath.LeafName("leafname/a/")); Assert.AreEqual("a", NfsPath.LeafName("/leafname/a")); Assert.AreEqual("a", NfsPath.LeafName("/leafname/a/")); }
public Nfs3Procedure.Status TryGetSharedObject(String localPathAndName, out ShareObject shareObject) { return(TryGetSharedObject(localPathAndName, NfsPath.LeafName(localPathAndName), out shareObject)); }