Esempio n. 1
0
        /// <summary>
        /// Get the relative path to another file.
        /// </summary>
        /// <param name="to">The target file path.</param>
        /// <returns>A <see cref="FilePath"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="to"/> is <see langword="null"/></exception>
        public FilePath GetRelativePath(FilePath to)
        {
            if (to == null)
            {
                throw new ArgumentNullException(nameof(to));
            }

            return(GetRelativePath(to.GetDirectory()).GetFilePath(to.GetFilename()));
        }
Esempio n. 2
0
        /// <summary>
        /// Combines the current path with the file name of a <see cref="FilePath"/>.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <returns>A combination of the current path and the file name of the provided <see cref="FilePath"/>.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="path"/> is <see langword="null"/></exception>
        public FilePath GetFilePath(FilePath path)
        {
            if (path == null)
            {
                throw new ArgumentNullException(nameof(path));
            }

            var combinedPath = System.IO.Path.Combine(FullPath, path.GetFilename().FullPath);

            return(new FilePath(combinedPath));
        }