Example #1
0
        /// <inheritdoc/>
        public Task <IUnixFileSystemEntry> GetEntryByNameAsync(IUnixDirectoryEntry directoryEntry, string name, CancellationToken cancellationToken)
        {
            var searchDirInfo = ((RemoteDirectoryEntry)directoryEntry).Info;
            var fullPath      = Path.Combine(searchDirInfo.FullName, name);
            IUnixFileSystemEntry result;

            if (File.Exists(fullPath))
            {
                result = new RemoteFileEntry(this, new FileInfo(fullPath));
            }
            else if (Directory.Exists(fullPath))
            {
                result = new RemoteDirectoryEntry(this, new DirectoryInfo(fullPath), false);
            }
            else
            {
                result = null;
            }
            return(Task.FromResult(result));
        }
Example #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RemoteFileSystem"/> class.
 /// </summary>
 /// <param name="rootPath">The path to use as root</param>
 /// <param name="allowNonEmptyDirectoryDelete">Allow deletion of non-empty directories?</param>
 public RemoteFileSystem(string rootPath, bool allowNonEmptyDirectoryDelete)
 {
     FileSystemEntryComparer = StringComparer.OrdinalIgnoreCase;
     Root = new RemoteDirectoryEntry(this, Directory.CreateDirectory(rootPath), true);
     SupportsNonEmptyDirectoryDelete = allowNonEmptyDirectoryDelete;
 }