Skip to content

Commit 1247904

Browse files
committed
feat: Warn user on startup if a mixed v1/v2 install is detected
We get frequent reports for users - in particular on the portable version - who just mix v1 and v2 files. Since this causes incompatible localization files to be merged, SyncTrayzor eventually crashes. This upgrade procedure has never been supported by SyncTrayzor, but it likely worked reasonably well enough in the past. Warn if this is detected and instruct users to clean their install. We also sometimes get reports of users on the installed version hitting this problem. However, the v2 installer should remove v1 files, so it is unclear why the installed version is sometimes affected by this as well. A possibility is that it is caused by v1 files being locked by a stuck v1 exe. In this case users also likely need to retry the installation.
1 parent 4efef47 commit 1247904

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/SyncTrayzor/Bootstrapper.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ protected override void ConfigureIoC(IStyletIoCBuilder builder)
7878
builder.Bind<IPathTransformer>().To<PathTransformer>().InSingletonScope();
7979
builder.Bind<IConnectedEventDebouncer>().To<ConnectedEventDebouncer>();
8080
builder.Bind<IDonationManager>().To<DonationManager>().InSingletonScope();
81+
builder.Bind<IInstallationHealthCheck>().To<InstallationHealthCheck>().InSingletonScope();
8182

8283
if (AppSettings.Instance.Variant == SyncTrayzorVariant.Installed)
8384
builder.Bind<IUpdateVariantHandler>().To<InstalledUpdateVariantHandler>();
@@ -233,6 +234,8 @@ protected override void Configure()
233234
{
234235
RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly;
235236
}
237+
238+
Container.Get<IInstallationHealthCheck>().CheckOutdatedV1Installation();
236239
}
237240

238241
protected override void Launch()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.IO;
3+
using Stylet;
4+
5+
namespace SyncTrayzor.Services;
6+
7+
public interface IInstallationHealthCheck
8+
{
9+
void CheckOutdatedV1Installation();
10+
}
11+
12+
public class InstallationHealthCheck(IWindowManager windowManager) : IInstallationHealthCheck
13+
{
14+
public void CheckOutdatedV1Installation()
15+
{
16+
var programDirectory = AppDomain.CurrentDomain.BaseDirectory;
17+
var v1File = Path.Combine(programDirectory, "Pri.LongPath.dll");
18+
if (File.Exists(v1File))
19+
{
20+
windowManager.ShowMessageBox(
21+
"It looks like this SyncTrayzor installation contains files from SyncTrayzor v1. This will likely cause SyncTrayzor to crash. Please uninstall and re-install SyncTrayzor to remove v1 installation files. If you are running the portable version, you can move the \"data\" folder from your existing install to keep user data.",
22+
"Mixed v1/v2 Installation Detected", System.Windows.MessageBoxButton.OK,
23+
System.Windows.MessageBoxImage.Warning);
24+
}
25+
}
26+
}

0 commit comments

Comments
 (0)