public override bool CanGetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory, out string failureReason) { Debug.Assert(pivotDirectory != null); // Enforced by contract string pathResultUnused; return(AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out pathResultUnused, out failureReason)); }
public override bool CanGetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory, out string failureMessage) { Argument.IsNotNull(nameof(pivotDirectory), pivotDirectory); string pathResultUnused; return(AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out pathResultUnused, out failureMessage)); }
// // Absolute/Relative pathString conversion // IRelativeDirectoryPath IAbsoluteDirectoryPath.GetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory) { Debug.Assert(pivotDirectory != null); string pathRelativeString, failureReason; if (!AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out pathRelativeString, out failureReason)) { throw new ArgumentException(failureReason); } Debug.Assert(pathRelativeString != null); Debug.Assert(pathRelativeString.Length > 0); return(pathRelativeString.ToRelativeDirectoryPath()); }
// // Absolute/Relative pathString conversion // IRelativeFilePath IAbsoluteFilePath.GetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory) { Debug.Assert(pivotDirectory != null); // Enforced by contract string pathRelative, failureReason; if (!AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out pathRelative, out failureReason)) { throw new ArgumentException(failureReason); } Debug.Assert(pathRelative != null); Debug.Assert(pathRelative.Length > 0); return(new RelativeFilePath(pathRelative + MiscHelpers.DIR_SEPARATOR_CHAR + FileName)); }
IRelativeFilePath IAbsoluteFilePath.GetRelativePathFrom(IAbsoluteDirectoryPath pivotDirectory) { Argument.IsNotNull(nameof(pivotDirectory), pivotDirectory); string relativePath, failureMessage; if (!AbsoluteRelativePathHelpers.TryGetRelativePath(pivotDirectory, this, out relativePath, out failureMessage)) { throw new ArgumentException(failureMessage); } //Debug.Assert(pathRelative != null); //Debug.Assert(pathRelative.Length > 0); return(new RelativeFilePath(relativePath + MiscHelpers.DirectorySeparatorChar + FileName)); }