static bool GetMountPoint(string[] args)
 {
     if (args.Length < 1)
     {
         Console.WriteLine("Usage: getmountpoint <file>");
         return(false);
     }
     Console.WriteLine(physFS.GetMountPoint(args[0]));
     return(true);
 }
Пример #2
0
        public void Mounting()
        {
            using var pfs = new PhysFS("");
            pfs.GetSearchPath().Should().BeEmpty();

            pfs.Mount("./", "/", false);

            pfs.GetSearchPath().Should().BeEquivalentTo(new string[] { "./" });
            pfs.GetMountPoint("./").Should().Be("/");
            pfs.IsDirectory("/").Should().BeTrue();

            pfs.Mount("../", "foo", true);
            pfs.GetSearchPath().Should().BeEquivalentTo(new string[] { "./", "../" });
            pfs.GetMountPoint("../").Should().Be("foo/");
            pfs.IsDirectory("/foo").Should().BeTrue();

            pfs.Mount("../../", "bar", false);
            pfs.GetSearchPath().Should().BeEquivalentTo(new string[] { "../../", "./", "../" });
            pfs.GetMountPoint("../../").Should().Be("bar/");
            pfs.IsDirectory("/bar").Should().BeTrue();

            pfs.UnMount("../");
            pfs.GetSearchPath().Should().BeEquivalentTo(new string[] { "../../", "./" });
        }
        void Mounting()
        {
            using (var pfs = new PhysFS(""))
            {
                Assert.Empty(pfs.GetSearchPath());
                pfs.Mount("./", "/", false);
                Assert.Equal(new string[] { "./" }, pfs.GetSearchPath());
                Assert.Equal("/", pfs.GetMountPoint("./"));
                Assert.True(pfs.IsDirectory("/"));

                pfs.Mount("../", "foo", true);
                Assert.Equal(new string[] { "./", "../", }, pfs.GetSearchPath());
                Assert.Equal("foo/", pfs.GetMountPoint("../"));
                Assert.True(pfs.IsDirectory("/foo"));

                pfs.Mount("../../", "bar", false);
                Assert.Equal(new string[] { "../../", "./", "../", }, pfs.GetSearchPath());
                Assert.Equal("bar/", pfs.GetMountPoint("../../"));
                Assert.True(pfs.IsDirectory("/bar"));

                pfs.RemoveFromSearchPath("../");
                Assert.Equal(new string[] { "../../", "./", }, pfs.GetSearchPath());
            }
        }