Example #1
0
        Directory GetRootDirectory(PathName name)
        {
            string root = Path.GetPathRoot(name.GetAbsolutePath());

            var di = new DirectoryInfo(root);

            return new DotNetDirectory(DirectoryName.GetDirectoryName(di.FullName));
        }
Example #2
0
        public override PathName Combine(PathName child)
        {
            if (child is AbsolutePathName)
                throw new InvalidOperationException("Cannot combine an absolute path with a zip path");

            if (child is ZipPathName)
                throw new IOException("Cannot combine a zip file path with a zip file path");

            return new ZipPathName(_zipFilePath, Path.Combine(_contentFilePath, child.GetPath()));
        }
Example #3
0
        public static FileName GetFileName(PathName pathName)
        {
            if (pathName is RelativePathName)
                return new RelativeFileName(((RelativePathName)pathName));

            if (pathName is AbsolutePathName)
                return new AbsoluteFileName(((AbsolutePathName)pathName));

            throw new InvalidOperationException("Unable to convert path: " + pathName);
        }
Example #4
0
        Directory ResolveDirectory(PathName name)
        {
            Directory rootDirectory = GetRootDirectory(name);

            string relativePath = name.GetAbsolutePath().Substring(rootDirectory.Name.GetPath().Length);

            string[] names = relativePath.Split('\\', '/');

            return ResolveDirectory(rootDirectory, names);
        }
Example #5
0
 public abstract DirectoryName Combine(PathName child);
Example #6
0
 public static DirectoryName GetDirectoryName(PathName pathName)
 {
     return GetDirectoryName(pathName.GetPath());
 }
Example #7
0
 public override DirectoryName Combine(PathName child)
 {
     return base.Combine(child);
 }
Example #8
0
 public abstract PathName Combine(PathName child);