/// <summary> /// Creates a file descriptor from the given path. If the given path is relative, the current directory /// is used to make the descriptor rooted. /// </summary> /// <exception cref="System.ArgumentNullException">The specified file system or the specified path is null.</exception> /// <exception cref="System.IO.PathTooLongException">The specified path, in its canonical form, exceeds /// the system-defined maximum length.</exception> /// <exception cref="fs4net.Framework.InvalidPathException">The specified path contains invalid characters, /// contains an invalid drive letter, or is invalid in some other way.</exception> public static RootedFile FileFromCurrentDirectory(IFileSystem fileSystem, string path) { ThrowHelper.ThrowIfNull(fileSystem, "fileSystem"); if (path.IsValidRootedFile()) { return fileSystem.FileDescribing(path); } return fileSystem.DirectoryDescribingCurrentDirectory() + RelativeFile.FromString(path); }