Skip to content

Pulling a folder that contains "." in it #101

Open
@itapi

Description

@itapi

Describe the bug

The new 3.2.11 release is really good,but it's still has bugs ,such as I cannot pull a folder that it's name contains dots in it(such as common package names folders).

On any other folders it works perfect!!

static AdbClient adbClient;
static DeviceData device;
private async void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
    adbClient = new AdbClient();
    adbClient.Connect("127.0.0.1:62001");
    device = adbClient.GetDevices().FirstOrDefault(); // Get first connected device
    SyncService service = new SyncService(device);

    await PullFolderAsync("/sdcard/android/data/com.globile.mycontactbackup/files", @"C:\Users\Itamar\Documents\UBL");

}
SyncService service;
async Task PullFolderAsync(string remotePath, string localPath)
{
    if (!Directory.Exists(localPath))
    {
        Directory.CreateDirectory(localPath);
    }

    service = new SyncService(device);

    FileStatistics stat = await service.StatAsync(remotePath);
    await PullFolderAsyncInternal(stat, remotePath, localPath);

}
async Task PullFolderAsyncInternal(FileStatistics stat, string remotePath, string localPath)
{
    switch (stat.get_FileMode().GetFileType())
    {
        case UnixFileStatus.Directory:
            if (remotePath != stat.Path)
            {
                localPath = System.IO.Path.Combine(localPath, stat.Path);
                remotePath = LinuxPath.Combine(remotePath, stat.Path);
            }
            if (!Directory.Exists(localPath))
            {
                Directory.CreateDirectory(localPath);
            }
            foreach (FileStatistics item in await service.GetDirectoryListingAsync(remotePath))
            {
                await PullFolderAsyncInternal(item, remotePath, localPath);
            }
            break;
        case UnixFileStatus.Regular:
            string localFilePath = System.IO.Path.Combine(localPath, stat.Path);
            using (FileStream stream = File.OpenWrite(localFilePath))
            {
                await service.PullAsync(LinuxPath.Combine(remotePath, stat.Path), stream);
                await stream.FlushAsync();
            }
            break;
    }
}

Steps to reproduce the bug

pull folders

Expected behavior

No response

Screenshots

No response

NuGet package version

None

.NET Platform

No response

Platform type

No response

System version

No response

IDE

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions