mirror of
https://github.com/Tyrrrz/DiscordChatExporter.git
synced 2026-02-14 07:43:31 -07:00
Fix crash when exporting multiple channels to drive root (#1399)
This commit is contained in:
parent
cc92b2cbe6
commit
d071459a5b
|
|
@ -60,7 +60,7 @@ public class DialogManager : IDisposable
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return file?.Path.LocalPath;
|
return file?.TryGetLocalPath() ?? file?.Path.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string?> PromptDirectoryPathAsync(string defaultDirPath = "")
|
public async Task<string?> PromptDirectoryPathAsync(string defaultDirPath = "")
|
||||||
|
|
@ -69,19 +69,21 @@ public class DialogManager : IDisposable
|
||||||
Application.Current?.ApplicationLifetime?.TryGetTopLevel()
|
Application.Current?.ApplicationLifetime?.TryGetTopLevel()
|
||||||
?? throw new ApplicationException("Could not find the top-level visual element.");
|
?? throw new ApplicationException("Could not find the top-level visual element.");
|
||||||
|
|
||||||
var startLocation = await topLevel.StorageProvider.TryGetFolderFromPathAsync(
|
var result = await topLevel.StorageProvider.OpenFolderPickerAsync(
|
||||||
defaultDirPath
|
|
||||||
);
|
|
||||||
|
|
||||||
var folderPickResult = await topLevel.StorageProvider.OpenFolderPickerAsync(
|
|
||||||
new FolderPickerOpenOptions
|
new FolderPickerOpenOptions
|
||||||
{
|
{
|
||||||
AllowMultiple = false,
|
AllowMultiple = false,
|
||||||
SuggestedStartLocation = startLocation,
|
SuggestedStartLocation = await topLevel.StorageProvider.TryGetFolderFromPathAsync(
|
||||||
|
defaultDirPath
|
||||||
|
),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return folderPickResult.FirstOrDefault()?.Path.LocalPath;
|
var directory = result.FirstOrDefault();
|
||||||
|
if (directory is null)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return directory.TryGetLocalPath() ?? directory.Path.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose() => _dialogLock.Dispose();
|
public void Dispose() => _dialogLock.Dispose();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue