merge: rc.14 parcel layout
This commit is contained in:
commit
e97df55840
24 files changed
+605
-21
No files matched your search
@@ -20,7 +20,7 @@ public static class ArchiveFailures
|
||||
// any more (FrameTrash.RestoreAsync). Other IOExceptions and InvalidDataExceptions (a sidecar of another sequence)
|
||||
// carry technical text.
|
||||
LeaseUnavailableException or NewerFormatException or StaleRenamePlanException or NestedRenameException or StaleDeletePlanException
|
||||
or SequenceInLibraryException or TrashMismatchException or Core.Project.ProjectTooLargeException => ex.Message,
|
||||
or SequenceInLibraryException or TrashMismatchException or Core.Project.ProjectTooLargeException or ArchiveStructureException => ex.Message,
|
||||
UnauthorizedAccessException => Loc.L("Archive.Failed.Access"),
|
||||
DatabaseException => Loc.L("Archive.Failed.Index"),
|
||||
ArgumentException => Loc.L("Archive.Failed.Gone"),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.IO;
|
||||
using Chronos.App.Archiving;
|
||||
using Chronos.Core.Archiving;
|
||||
using Chronos.Core.Diagnostics;
|
||||
using Chronos.Data.Archiving;
|
||||
|
||||
@@ -35,8 +36,14 @@ public sealed class EngineArchiveSetup(AppServices services) : IArchiveSetup
|
||||
var defaults = services.Settings.ArchiveDefaults();
|
||||
var archive = await Task.Run(async () =>
|
||||
{
|
||||
Directory.CreateDirectory(root);
|
||||
return await archives.AdoptAsync(root, defaults, cancellationToken).ConfigureAwait(false);
|
||||
// A new archive is made with its whole layout (the folder itself included), or not at all; an existing one gets
|
||||
// the folders it lacks. One that can be written but not completed is refused with the reason, before it becomes
|
||||
// the archive of this PC; a read-only one opens as before, to be browsed.
|
||||
var opened = await archives.AdoptAsync(root, defaults, cancellationToken).ConfigureAwait(false);
|
||||
var paths = new ArchivePaths(root);
|
||||
if (ArchiveStructure.Ensure(paths) is { IsComplete: false } structure && ArchiveVolume.Probe(paths) == ArchiveAvailability.Online)
|
||||
throw new ArchiveStructureException(structure);
|
||||
return opened;
|
||||
}, cancellationToken);
|
||||
services.Settings.LastArchivePath = root;
|
||||
services.SaveSettings();
|
||||
|
||||
@@ -1180,9 +1180,11 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
{
|
||||
var opened = await Task.Run(async () => File.Exists(new ArchivePaths(root).ManifestPath) ? await archives.OpenAsync(root) : null);
|
||||
if (opened is not null) await Shell.Services.QueueScanAsync(opened, full: false);
|
||||
// A folder that is no archive yet becomes one in place, with the archive's whole layout (as Welcome's Create).
|
||||
else await Shell.Services.ArchiveSetup.CreateAsync(root);
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or NewerFormatException
|
||||
or DatabaseException)
|
||||
or DatabaseException or ArgumentException or InvalidOperationException)
|
||||
{
|
||||
Log.Warning("settings", $"The archive at {root} could not be opened", ex);
|
||||
Shell.Notify(Loc.L("Errors.Archive.Open"), ArchiveActions.Cause(ex), isError: true);
|
||||
|
||||
Reference in new issue
Block a user