/// <summary> /// Creates a copy of Crosspath instance. /// </summary> /// <param name="xpath">Source instance.</param> protected Crosspath(Crosspath xpath) : this() { SourceString = xpath.SourceString; Origin = xpath.Origin; Flavor = xpath.Flavor; WindowsRootDrive = xpath.WindowsRootDrive; directories = new LinkedList <String>(xpath.directories); }
/// <summary> /// Creates RelativeCrosspath from string. /// If string does not contain a relative path, then throw an exception. /// </summary> /// <param name="path"></param> /// <returns></returns> public new static RelativeCrosspath FromString(String path) { Crosspath xpath = Crosspath.FromString(path); if (!(xpath is RelativeCrosspath)) { throw new CrosspathLibException("the path provided is not relative"); } return(xpath as RelativeCrosspath); }
public static AbsoluteCrosspath FromString(String path, AbsoluteCrosspath workingDir) { Crosspath xpath = Crosspath.FromString(path); if (!(xpath is AbsoluteCrosspath)) { return(((RelativeCrosspath)xpath).Absolutized(workingDir)); } return(xpath as AbsoluteCrosspath); }
/// <summary> /// Creates AbsoluteCrosspath from string. /// If string does not contain an absolute path, then throw an exception. /// </summary> /// <param name="path"></param> /// <returns></returns> public new static AbsoluteCrosspath FromString(String path) { Crosspath xpath = Crosspath.FromString(path); if (!(xpath is AbsoluteCrosspath)) { throw new CrosspathLibException("the path provided is not absolute"); } return(xpath as AbsoluteCrosspath); }