fix: full verification against the brief — 137 confirmed findings fixed over six passes #4
No files matched your search
@@ -8,10 +8,12 @@
|
||||
<data name="Settings.Advanced.BackupDone" xml:space="preserve"><value>Index backed up</value></data>
|
||||
<data name="Settings.Advanced.BackupNow" xml:space="preserve"><value>Back up now</value></data>
|
||||
<data name="Settings.Advanced.DataFolder" xml:space="preserve"><value>Data folder</value></data>
|
||||
<data name="Settings.Advanced.DataInOneDrive" xml:space="preserve"><value>Data inside OneDrive</value></data>
|
||||
<data name="Settings.Advanced.DataOutsideOneDrive" xml:space="preserve"><value>Data kept outside OneDrive</value><comment>long</comment></data>
|
||||
<data name="Settings.Advanced.Diagnostics" xml:space="preserve"><value>Diagnostics</value></data>
|
||||
<data name="Settings.Advanced.DiagnosticsDone" xml:space="preserve"><value>Diagnostics bundle saved</value></data>
|
||||
<data name="Settings.Advanced.DiagnosticsTitle" xml:space="preserve"><value>Save the diagnostics bundle to</value></data>
|
||||
<data name="Settings.Advanced.EarlierData" xml:space="preserve"><value>Earlier data unused</value></data>
|
||||
<data name="Settings.Advanced.ExportBundle" xml:space="preserve"><value>Export bundle</value></data>
|
||||
<data name="Settings.Advanced.Logs" xml:space="preserve"><value>Logs</value></data>
|
||||
<data name="Settings.Advanced.NoBackups" xml:space="preserve"><value>No backups yet</value></data>
|
||||
|
||||
@@ -528,10 +528,12 @@
|
||||
<data name="Tooltips.Settings.ClearCache" xml:space="preserve"><value>Delete the cache contents now</value></data>
|
||||
<data name="Tooltips.Settings.ClearCacheAsk" xml:space="preserve"><value>Delete spilled frames and cached thumbnails; asks first</value></data>
|
||||
<data name="Tooltips.Settings.DataFolder" xml:space="preserve"><value>Database, settings, logs and caches of this PC</value></data>
|
||||
<data name="Tooltips.Settings.DataInOneDrive" xml:space="preserve"><value>Open the data folder in Explorer. OneDrive synchronises it, which can damage the index: exclude it from syncing</value></data>
|
||||
<data name="Tooltips.Settings.DeepAfterImport" xml:space="preserve"><value>New cards and folders queue a deep analysis of what they import, in the background; each card can change it</value></data>
|
||||
<data name="Tooltips.Settings.DeepAfterScan" xml:space="preserve"><value>Sequences a scan finds (adopted folders, new sidecars) also get a deep analysis, in the background</value></data>
|
||||
<data name="Tooltips.Settings.DefaultServer" xml:space="preserve"><value>Server Titano connects to at start; changing it signs out · Enter applies, Esc reverts</value></data>
|
||||
<data name="Tooltips.Settings.Diagnostics" xml:space="preserve"><value>Zip the logs, a system and codec report, settings and recent failed jobs into a folder you choose; passwords, tokens and photos are left out</value></data>
|
||||
<data name="Tooltips.Settings.EarlierData" xml:space="preserve"><value>Open the data this portable copy kept beside it before it ran from OneDrive. Titano no longer uses it and leaves it as it is</value></data>
|
||||
<data name="Tooltips.Settings.Export" xml:space="preserve"><value>Save every setting as JSON, without the session token</value></data>
|
||||
<data name="Tooltips.Settings.FileTemplate" xml:space="preserve"><value>File name of each frame, for example {date}_{time}_{n:0000}; the extension is added · Enter applies, Esc reverts</value></data>
|
||||
<data name="Tooltips.Settings.FolderTemplate" xml:space="preserve"><value>Archive folders, for example {year}/{date} {camera}; a slash starts a subfolder · Enter applies, Esc reverts</value></data>
|
||||
|
||||
@@ -8,10 +8,12 @@
|
||||
<data name="Settings.Advanced.BackupDone" xml:space="preserve"><value>Copia dell'indice salvata</value></data>
|
||||
<data name="Settings.Advanced.BackupNow" xml:space="preserve"><value>Salva una copia</value></data>
|
||||
<data name="Settings.Advanced.DataFolder" xml:space="preserve"><value>Cartella dati</value></data>
|
||||
<data name="Settings.Advanced.DataInOneDrive" xml:space="preserve"><value>Dati dentro OneDrive</value></data>
|
||||
<data name="Settings.Advanced.DataOutsideOneDrive" xml:space="preserve"><value>Dati tenuti fuori da OneDrive</value></data>
|
||||
<data name="Settings.Advanced.Diagnostics" xml:space="preserve"><value>Diagnostica</value></data>
|
||||
<data name="Settings.Advanced.DiagnosticsDone" xml:space="preserve"><value>Pacchetto diagnostico salvato</value></data>
|
||||
<data name="Settings.Advanced.DiagnosticsTitle" xml:space="preserve"><value>Salva il pacchetto in</value></data>
|
||||
<data name="Settings.Advanced.EarlierData" xml:space="preserve"><value>Dati precedenti inutilizzati</value></data>
|
||||
<data name="Settings.Advanced.ExportBundle" xml:space="preserve"><value>Esporta pacchetto</value></data>
|
||||
<data name="Settings.Advanced.Logs" xml:space="preserve"><value>Log</value></data>
|
||||
<data name="Settings.Advanced.NoBackups" xml:space="preserve"><value>Ancora nessuna copia</value></data>
|
||||
|
||||
@@ -528,10 +528,12 @@
|
||||
<data name="Tooltips.Settings.ClearCache" xml:space="preserve"><value>Elimina adesso il contenuto della cache</value></data>
|
||||
<data name="Tooltips.Settings.ClearCacheAsk" xml:space="preserve"><value>Elimina fotogrammi temporanei e miniature in cache; prima chiede conferma</value></data>
|
||||
<data name="Tooltips.Settings.DataFolder" xml:space="preserve"><value>Database, impostazioni, log e cache di questo PC</value></data>
|
||||
<data name="Tooltips.Settings.DataInOneDrive" xml:space="preserve"><value>Apri la cartella dati in Esplora file. OneDrive la sincronizza e così può danneggiare l'indice: escludila dalla sincronizzazione</value></data>
|
||||
<data name="Tooltips.Settings.DeepAfterImport" xml:space="preserve"><value>Schede e cartelle nuove accodano l'analisi profonda di ciò che importano, in background; ogni scheda può cambiarlo</value></data>
|
||||
<data name="Tooltips.Settings.DeepAfterScan" xml:space="preserve"><value>Anche le sequenze trovate da una scansione (cartelle adottate, nuovi sidecar) ricevono l'analisi profonda, in background</value></data>
|
||||
<data name="Tooltips.Settings.DefaultServer" xml:space="preserve"><value>Server a cui Titano si connette all'avvio; cambiarlo chiude l'accesso · Invio applica, Esc annulla</value></data>
|
||||
<data name="Tooltips.Settings.Diagnostics" xml:space="preserve"><value>Comprime log, rapporto su sistema e codec, impostazioni e attività fallite di recente in una cartella a tua scelta; password, token e foto restano fuori</value></data>
|
||||
<data name="Tooltips.Settings.EarlierData" xml:space="preserve"><value>Apri i dati che questa copia portatile teneva accanto a sé prima di trovarsi in OneDrive. Titano non li usa più e li lascia com'erano</value></data>
|
||||
<data name="Tooltips.Settings.Export" xml:space="preserve"><value>Salva tutte le impostazioni in JSON, senza il token di sessione</value></data>
|
||||
<data name="Tooltips.Settings.FileTemplate" xml:space="preserve"><value>Nome del file di ogni fotogramma, ad esempio {date}_{time}_{n:0000}; l'estensione viene aggiunta · Invio applica, Esc annulla</value></data>
|
||||
<data name="Tooltips.Settings.FolderTemplate" xml:space="preserve"><value>Cartelle dell'archivio, ad esempio {year}/{date} {camera}; la barra crea una sottocartella · Invio applica, Esc annulla</value></data>
|
||||
|
||||
@@ -46,7 +46,9 @@ public partial class App : Application
|
||||
Log.SetSink(capture ? new TeeLogSink(_log, new StderrLogSink()) : _log);
|
||||
Log.Info("app", $"Titano {AppServices.VersionText} starting; data at {Environment.DataDirectory}");
|
||||
// Settings tells the user once the window is up.
|
||||
if (Environment.SyncedFolder is { } synced) Log.Warning("app", $"This portable copy runs in the OneDrive folder {synced}: its data is kept outside it");
|
||||
if (Environment.PortableSyncRoot is { } portableIn) Log.Warning("app", $"This portable copy runs in the OneDrive folder {portableIn}: its data is kept outside it");
|
||||
if (Environment.EarlierPortableData is { } earlier) Log.Warning("app", $"The data this portable copy kept in {earlier} before is left there and no longer used");
|
||||
if (Environment.SyncedFolder is { } synced) Log.Warning("app", $"The data folder lies in the OneDrive folder {synced}: synchronisation may damage the index");
|
||||
|
||||
var projectFile = capture ? null : ProjectFileArgument(e.Args);
|
||||
if (!capture)
|
||||
|
||||
@@ -7,16 +7,20 @@ namespace Titano.App.Infrastructure;
|
||||
/// Where the client keeps its data (BRIEF §6.2, <see cref="AppPaths"/>): <c>%LOCALAPPDATA%\Titano</c>, or <c>.\data</c>
|
||||
/// next to the executable when <c>portable.txt</c> exists. Never inside a folder OneDrive synchronises (SQLite corrupts
|
||||
/// there): a portable copy in one keeps its data in <c>%LOCALAPPDATA%\Titano</c>, and Settings tells the user so
|
||||
/// (<see cref="SyncedFolder"/>).
|
||||
/// (<see cref="PortableSyncRoot"/>, <see cref="EarlierPortableData"/>). When that folder itself lies in one, nowhere
|
||||
/// is safe: Titano starts all the same and Settings warns (<see cref="SyncedFolder"/>).
|
||||
/// </summary>
|
||||
public sealed class AppEnvironment
|
||||
{
|
||||
private AppEnvironment(string dataDirectory, bool portable, bool isCapture, string? syncedFolder = null)
|
||||
private AppEnvironment(string dataDirectory, bool portable, bool isCapture, string? syncedFolder = null, string? portableSyncRoot = null,
|
||||
string? earlierPortableData = null)
|
||||
{
|
||||
DataDirectory = dataDirectory;
|
||||
IsPortable = portable;
|
||||
IsCapture = isCapture;
|
||||
SyncedFolder = syncedFolder;
|
||||
PortableSyncRoot = portableSyncRoot;
|
||||
EarlierPortableData = earlierPortableData;
|
||||
Directory.CreateDirectory(DataDirectory);
|
||||
Directory.CreateDirectory(LogDirectory);
|
||||
Directory.CreateDirectory(CacheDirectory);
|
||||
@@ -28,20 +32,30 @@ public sealed class AppEnvironment
|
||||
/// <summary>A throw-away environment for <c>--capture</c>: nothing of the user's data is read or written.</summary>
|
||||
public bool IsCapture { get; }
|
||||
|
||||
/// <summary>The OneDrive folder this portable copy runs from; its data is in <c>%LOCALAPPDATA%\Titano</c> instead of <c>.\data</c>. Null otherwise.</summary>
|
||||
/// <summary>The OneDrive folder <see cref="DataDirectory"/> itself lies in, where the index may be damaged; null when it is safe.</summary>
|
||||
public string? SyncedFolder { get; }
|
||||
|
||||
/// <summary>The OneDrive folder this portable copy runs from; its data is in <c>%LOCALAPPDATA%\Titano</c> instead of <c>.\data</c>. Null otherwise.</summary>
|
||||
public string? PortableSyncRoot { get; }
|
||||
|
||||
/// <summary>The <c>.\data</c> folder this portable copy used before it ran from OneDrive, left as it was; null when there is none.</summary>
|
||||
public string? EarlierPortableData { get; }
|
||||
|
||||
public string LogDirectory => Path.Combine(DataDirectory, "logs");
|
||||
public string CacheDirectory => Path.Combine(DataDirectory, "cache");
|
||||
public string BackupDirectory => Path.Combine(DataDirectory, "backups");
|
||||
public string DatabasePath => Path.Combine(DataDirectory, "titano.db");
|
||||
public string SettingsPath => Path.Combine(DataDirectory, "settings.json");
|
||||
public string DatabasePath => Path.Combine(DataDirectory, AppPaths.DatabaseFileName);
|
||||
public string SettingsPath => Path.Combine(DataDirectory, AppPaths.SettingsFileName);
|
||||
|
||||
/// <summary>The environment of this process: its executable's folder and the user's OneDrive folders decide.</summary>
|
||||
public static AppEnvironment Detect() => From(AppPaths.Resolve());
|
||||
|
||||
/// <summary>The environment at <paramref name="paths"/> (its folders are created).</summary>
|
||||
public static AppEnvironment From(AppPaths paths) => new(paths.DataRoot, paths.IsPortable, isCapture: false, paths.PortableSyncRoot);
|
||||
public static AppEnvironment From(AppPaths paths)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(paths);
|
||||
return new(paths.DataRoot, paths.IsPortable, isCapture: false, paths.SyncedFolder, paths.PortableSyncRoot, paths.EarlierPortableData);
|
||||
}
|
||||
|
||||
/// <summary>A fresh temporary data folder for screenshots and smoke tests; delete it with <see cref="DeleteCaptureData"/>.</summary>
|
||||
public static AppEnvironment ForCapture() =>
|
||||
|
||||
@@ -808,10 +808,18 @@ public sealed class SettingsViewModel : SectionViewModel
|
||||
Shell.Notify(Loc.L("Settings.Advanced.RestoreFailed"), Loc.L("Errors.Backup.Deferred"), isError: true);
|
||||
break;
|
||||
}
|
||||
// BRIEF §6.2: a portable copy in a folder OneDrive synchronises keeps its data in this user's folder instead.
|
||||
if (Shell.Services.Environment.SyncedFolder is not null)
|
||||
// BRIEF §6.2: a portable copy in a folder OneDrive synchronises keeps its data in this user's folder instead, and
|
||||
// leaves the data it kept beside it before where it is. Only a user folder that is itself synchronised is unsafe.
|
||||
var environment = Shell.Services.Environment;
|
||||
if (environment.SyncedFolder is not null)
|
||||
Shell.Notify(Loc.L("Settings.Advanced.DataInOneDrive"), Formatting.LeftToRight(DataFolder), Loc.L("Common.Open"),
|
||||
Loc.L("Tooltips.Settings.DataInOneDrive"), () => ShellActions.Reveal(DataFolder), isError: true);
|
||||
else if (environment.PortableSyncRoot is not null)
|
||||
Shell.Notify(Loc.L("Settings.Advanced.DataOutsideOneDrive"), Formatting.LeftToRight(DataFolder), Loc.L("Common.Open"),
|
||||
Loc.L("Tooltips.Settings.OpenDataFolder"), () => ShellActions.Reveal(DataFolder));
|
||||
if (environment.EarlierPortableData is { } earlier)
|
||||
Shell.Notify(Loc.L("Settings.Advanced.EarlierData"), Formatting.LeftToRight(earlier), Loc.L("Common.Open"),
|
||||
Loc.L("Tooltips.Settings.EarlierData"), () => ShellActions.Reveal(earlier));
|
||||
Startup.Refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -6,20 +6,22 @@ namespace Titano.Core.Windows.Shell;
|
||||
/// Where the desktop programs keep their data (BRIEF §6.2, <see cref="DataLocation"/>): <c>%LOCALAPPDATA%\Titano</c>, or
|
||||
/// <c>.\data</c> next to the executable in portable mode. SQLite corrupts inside synchronised folders, so a portable
|
||||
/// copy in a OneDrive folder keeps its data in <c>%LOCALAPPDATA%\Titano</c> instead (<see cref="PortableSyncRoot"/>
|
||||
/// names that folder to tell the user), and a data root still under OneDrive is reported by <see cref="SyncedFolder"/>
|
||||
/// and refused by <see cref="CreateDirectories"/>.
|
||||
/// names that folder to tell the user, <see cref="EarlierPortableData"/> the data it kept there before), and a data
|
||||
/// root still under OneDrive is reported by <see cref="SyncedFolder"/> and refused by <see cref="CreateDirectories"/>.
|
||||
/// </summary>
|
||||
public sealed class AppPaths
|
||||
{
|
||||
public const string ProductFolderName = DataLocation.ProductFolderName;
|
||||
public const string DatabaseFileName = "titano.db";
|
||||
public const string SettingsFileName = "settings.json";
|
||||
|
||||
private AppPaths(DataLocation location)
|
||||
private AppPaths(DataLocation location, string? earlierPortableData)
|
||||
{
|
||||
DataRoot = location.Root;
|
||||
IsPortable = location.IsPortable;
|
||||
SyncedFolder = location.SyncedFolder;
|
||||
PortableSyncRoot = location.PortableSyncRoot;
|
||||
EarlierPortableData = earlierPortableData;
|
||||
}
|
||||
|
||||
/// <summary>A portable copy, also when its data had to go to <c>%LOCALAPPDATA%\Titano</c>.</summary>
|
||||
@@ -43,6 +45,12 @@ public sealed class AppPaths
|
||||
/// <summary>The OneDrive sync root a portable copy runs from, whose data is in <c>%LOCALAPPDATA%\Titano</c> instead; null otherwise.</summary>
|
||||
public string? PortableSyncRoot { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The <c>.\data</c> folder of a portable copy now in a OneDrive folder when it still holds the index or the settings
|
||||
/// of an earlier start: nothing moves or deletes it, and the user is told where it is. Null otherwise.
|
||||
/// </summary>
|
||||
public string? EarlierPortableData { get; }
|
||||
|
||||
/// <summary>Paths for this process: the executable's folder decides portable mode.</summary>
|
||||
public static AppPaths Resolve() => Resolve(AppContext.BaseDirectory, KnownFolders.LocalAppData);
|
||||
|
||||
@@ -51,8 +59,16 @@ public sealed class AppPaths
|
||||
Resolve(applicationDirectory, localAppData, OneDriveFolders.SyncRoots());
|
||||
|
||||
/// <summary>Paths for an executable in <paramref name="applicationDirectory"/>, checked against <paramref name="syncRoots"/>.</summary>
|
||||
public static AppPaths Resolve(string applicationDirectory, string localAppData, IReadOnlyCollection<string> syncRoots) =>
|
||||
new(DataLocation.Choose(applicationDirectory, PortableMode.IsEnabled(applicationDirectory), localAppData, syncRoots));
|
||||
public static AppPaths Resolve(string applicationDirectory, string localAppData, IReadOnlyCollection<string> syncRoots)
|
||||
{
|
||||
var location = DataLocation.Choose(applicationDirectory, PortableMode.IsEnabled(applicationDirectory), localAppData, syncRoots);
|
||||
var beside = Path.GetFullPath(Path.Combine(applicationDirectory, PortableMode.DataFolderName));
|
||||
var earlier = location.PortableSyncRoot is not null
|
||||
&& (File.Exists(Path.Combine(beside, DatabaseFileName)) || File.Exists(Path.Combine(beside, SettingsFileName)))
|
||||
? beside
|
||||
: null;
|
||||
return new AppPaths(location, earlier);
|
||||
}
|
||||
|
||||
/// <summary>Creates the data, logs, cache and thumbnails folders.</summary>
|
||||
/// <exception cref="InvalidOperationException">The data root lies inside a OneDrive-synced folder.</exception>
|
||||
|
||||
@@ -20,7 +20,9 @@ public sealed class AppEnvironmentTests(TestContext context)
|
||||
|
||||
Assert.Equal(Path.Combine(local, "Titano", "titano.db"), environment.DatabasePath);
|
||||
Assert.True(environment.IsPortable, "still a portable copy: updates fetch the portable zip, no sign-in entry");
|
||||
Assert.Equal<string?>(oneDrive, environment.SyncedFolder);
|
||||
Assert.Equal<string?>(oneDrive, environment.PortableSyncRoot);
|
||||
Assert.Null(environment.SyncedFolder);
|
||||
Assert.Null(environment.EarlierPortableData);
|
||||
Assert.True(Directory.Exists(environment.LogDirectory));
|
||||
Assert.False(Directory.Exists(Path.Combine(app, "data")), "nothing is written into the synchronised folder");
|
||||
|
||||
@@ -29,6 +31,52 @@ public sealed class AppEnvironmentTests(TestContext context)
|
||||
File.WriteAllText(Path.Combine(stick, PortableMode.MarkerFileName), "");
|
||||
var beside = AppEnvironment.From(AppPaths.Resolve(stick, local, [oneDrive]));
|
||||
Assert.Equal(Path.Combine(stick, "data"), beside.DataDirectory);
|
||||
Assert.Null(beside.PortableSyncRoot);
|
||||
Assert.Null(beside.SyncedFolder);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TheDataAPortableCopyKeptInOneDriveBeforeIsNamedAndLeftAlone()
|
||||
{
|
||||
var oneDrive = context.CreateTempDirectory("onedrive");
|
||||
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Documents", "Titano")).FullName;
|
||||
File.WriteAllText(Path.Combine(app, PortableMode.MarkerFileName), "");
|
||||
// An earlier version kept its index and settings beside the program.
|
||||
var earlier = Directory.CreateDirectory(Path.Combine(app, "data")).FullName;
|
||||
File.WriteAllText(Path.Combine(earlier, "settings.json"), "{}");
|
||||
File.WriteAllBytes(Path.Combine(earlier, "titano.db"), [1, 2, 3]);
|
||||
var local = context.CreateTempDirectory("local");
|
||||
|
||||
var environment = AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive]));
|
||||
|
||||
Assert.Equal<string?>(earlier, environment.EarlierPortableData);
|
||||
Assert.Equal(Path.Combine(local, "Titano"), environment.DataDirectory);
|
||||
Assert.SequenceEqual(new byte[] { 1, 2, 3 }, File.ReadAllBytes(Path.Combine(earlier, "titano.db")));
|
||||
Assert.Equal("{}", File.ReadAllText(Path.Combine(earlier, "settings.json")));
|
||||
|
||||
// A data folder with neither (logs only) holds nothing the user would miss.
|
||||
File.Delete(Path.Combine(earlier, "settings.json"));
|
||||
File.Delete(Path.Combine(earlier, "titano.db"));
|
||||
Directory.CreateDirectory(Path.Combine(earlier, "logs"));
|
||||
Assert.Null(AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive])).EarlierPortableData);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AUserFolderOneDriveSynchronisesIsReportedNotHidden()
|
||||
{
|
||||
// Nowhere is safe: Titano starts all the same, and the folder that is synchronised is named for the warning.
|
||||
var oneDrive = context.CreateTempDirectory("onedrive");
|
||||
var local = Directory.CreateDirectory(Path.Combine(oneDrive, "AppData", "Local")).FullName;
|
||||
|
||||
var installed = AppEnvironment.From(AppPaths.Resolve(context.CreateTempDirectory("app"), local, [oneDrive]));
|
||||
Assert.Equal<string?>(oneDrive, installed.SyncedFolder);
|
||||
Assert.Null(installed.PortableSyncRoot);
|
||||
Assert.True(Directory.Exists(installed.LogDirectory));
|
||||
|
||||
// A portable copy in that OneDrive has nowhere safe either: its data is not said to be kept outside it.
|
||||
var app = Directory.CreateDirectory(Path.Combine(oneDrive, "Desktop", "Titano")).FullName;
|
||||
File.WriteAllText(Path.Combine(app, PortableMode.MarkerFileName), "");
|
||||
var portable = AppEnvironment.From(AppPaths.Resolve(app, local, [oneDrive]));
|
||||
Assert.Equal<(string?, string?)>((oneDrive, oneDrive), (portable.SyncedFolder, portable.PortableSyncRoot));
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user