canton7 / SyncTrayzor

Windows tray utility / filesystem watcher / launcher for Syncthing
MIT License
5.95k stars 411 forks source link

Portable version doesn't run #271

Closed leaumar closed 8 years ago

leaumar commented 8 years ago

I downloaded the portable version, unzipped it, copied my installed version's data folder over, removed the installed version, and started the portable version. It worked as expected.

Today I started my computer and synctrayzor came up with the stacktrace at the bottom. When I run it manually, the same thing happens.

The error itself is strange because I'm 100% sure the listed path does in fact exist and I can even copy-paste and run it (leading to, of course, the same thing). No admin rights are needed anywhere in this folder either.

Version: 1.1.10.0; Variant: Portable; Arch: Amd64
Path: C:\Tools\SyncTrayzor\SyncTrayzorPortable-x64\SyncTrayzor.exe
System.IO.DirectoryNotFoundException: The system cannot find the path specified.

   at Pri.LongPath.File.Copy(String sourcePath, String destinationPath, Boolean overwrite)
   at SyncTrayzor.Services.FilesystemProvider.Copy(String from, String to) in C:\projects\synctrayzor\src\SyncTrayzor\Services\FilesystemProvider.cs:line 51
   at SyncTrayzor.Services.Config.ConfigurationProvider.Initialize(Configuration defaultConfiguration) in C:\projects\synctrayzor\src\SyncTrayzor\Services\Config\ConfigurationProvider.cs:line 120
   at SyncTrayzor.Bootstrapper.Configure() in C:\projects\synctrayzor\src\SyncTrayzor\Bootstrapper.cs:line 108
   at Stylet.BootstrapperBase.Start(String[] args) in c:\projects\stylet\Stylet\BootstrapperBase.cs:line 81
   at System.Windows.Application.OnStartup(StartupEventArgs e)
   at System.Windows.Application.<.ctor>b__1_0(Object unused)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
canton7 commented 8 years ago

Can I see the contents of your log file, please? You'll find it in logs\SyncTrayzor.log. That should tell us exactly what it was trying to do...

leaumar commented 8 years ago

SyncTrayzor.log.txt

Sorry about that, didn't think of adding it

canton7 commented 8 years ago

OK so the file it's trying to find is C:\Tools\SyncTrayzor\SyncTrayzorPortable-x64\syncthing.exe: can you confirm that that exists?

You say you've been using it for a while, then it suddenly broke. In order for that to happen, C:\Users\Marnes\AppData\Roaming\SyncTrayzor\syncthing.exe must have been deleted as well. Maybe some antivirus has gone rogue?

copied my installed version's data folder over

Do be aware that a couple of things differ between the default config files for the installed and portable versions. In particular, the installed version will (by default) tell Syncthing to use a data folder in %APPDATA%, and will put a copy of syncthing.exe in %APPDATA%, whereas the portable version will put both in the data folder inside the portable install dir.

It doesn't affect this issue, but something to bear in mind.

leaumar commented 8 years ago

quite sure

config.xml does indeed contain this though:

  <SyncthingPath>%APPDATA%\SyncTrayzor\syncthing.exe</SyncthingPath>
  <SyncthingCustomHomePath>%LOCALAPPDATA%\SyncTrayzor\syncthing</SyncthingCustomHomePath>

I'll fix these paths and let you know in a minute, but in the meantime, isn't it strange the config points to a different path than the one it's failing on?

leaumar commented 8 years ago

changing the paths to this fixed it:

  <SyncthingPath>syncthing.exe</SyncthingPath>
  <SyncthingCustomHomePath>data\syncthing</SyncthingCustomHomePath>

So really the question is why does the popup talk about a different, even invalid issue instead of the real problem? :P

canton7 commented 8 years ago

The dialog just contained the path to SyncTrayzor.exe - that's fine. It's slightly confusing that it happens to be next to an error message which talks about paths, but the whole thing's supposed to be reported on here anyway.

Those should be %EXEPATH%\data\syncthing.exe and %EXEPATH%\data\syncthing, otherwise things will break then starting SyncTrayzor from stuff like a shortcut.

Either way, that shouldn't have caused your issue... %APPDATA%\SyncTrayzor\syncthing.exe just specified a path to copy syncthing.exe to (so "your" version isn't overwritten by upgrades which SyncTrayzor does). Did you perhaps delete the folder %APPDATA%\SyncTrayzor?

leaumar commented 8 years ago

I did, yes.

I guess it makes sense now. The config referred to the old appdata path and that no longer existed, and the error message didn't actually specify the path it was failing on.

Thanks for the solution :)

canton7 commented 8 years ago

You have highlighted a bug though: I should ensure that the path to copy syncthing.exe to exists before I try and create it. Normally it's not an issue, as by default it refers to a path which SyncTrayzor creates anyway, but when users decide to customise things...

leaumar commented 8 years ago

Customise? I honestly just wanted to go from an installed copy to a portable one, and the instructions said to copy the data folder, and only that. I didn't touch the config or anything.

Sure, the instructions are for upgrading portable versions, not switching variants, but I figured it was closely enough related.

Anyway, glad we found the problem then :)

canton7 commented 8 years ago

It's effectively been customized, since the path isn't what a default installation would give you. Don't worry, the reason it's in the config file is so that people can change it.

I don't think I have instructions on converting from an installed version to a portable one?

leaumar commented 8 years ago

I only saw them for upgrading between portable versions, yeah