Titano: Library completion, remote editing, accessibility and RTL pass, remaining translations #3
@@ -261,8 +261,18 @@ public sealed class SequenceTrash
|
|||||||
var record = new TrashRecord(row, await _db.Renders.ListBySequenceAsync(sequence.Id, cancellationToken).ConfigureAwait(false), step.Files,
|
var record = new TrashRecord(row, await _db.Renders.ListBySequenceAsync(sequence.Id, cancellationToken).ConfigureAwait(false), step.Files,
|
||||||
step.Bytes, DateTimeOffset.UtcNow, deletedBy);
|
step.Bytes, DateTimeOffset.UtcNow, deletedBy);
|
||||||
// The record first: a crash before the move leaves a record without a folder, which the listing ignores.
|
// The record first: a crash before the move leaves a record without a folder, which the listing ignores.
|
||||||
AtomicFile.WriteAllText(Path.Combine(trash, name + RecordExtension), JsonSerializer.Serialize(record, TrashJson.Default.TrashRecord));
|
var recordPath = Path.Combine(trash, name + RecordExtension);
|
||||||
Directory.Move(folder.Folder, Path.Combine(trash, name));
|
AtomicFile.WriteAllText(recordPath, JsonSerializer.Serialize(record, TrashJson.Default.TrashRecord));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Directory.Move(folder.Folder, Path.Combine(trash, name));
|
||||||
|
}
|
||||||
|
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException)
|
||||||
|
{
|
||||||
|
// A file of the folder is open elsewhere: nothing moved, so the record goes and the rows stay.
|
||||||
|
File.Delete(recordPath);
|
||||||
|
throw;
|
||||||
|
}
|
||||||
entry = Entry(archive.Id, name, record);
|
entry = Entry(archive.Id, name, record);
|
||||||
}
|
}
|
||||||
await using (var tx = await _db.BeginAsync(cancellationToken).ConfigureAwait(false))
|
await using (var tx = await _db.BeginAsync(cancellationToken).ConfigureAwait(false))
|
||||||
|
|||||||
Reference in new issue
Block a user