File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed
Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ let MaxKeepLogLines = 200
5555 }
5656
5757 private func launchSync( ) {
58- NSLog ( " Launching Syncthing daemon " )
58+ NSLog ( " Launching Syncthing daemon: \( path ) " )
5959 shouldTerminate = false
6060
6161 // Since release v1.7.0-1 we don't allow Syncthing daemon to update by itself
Original file line number Diff line number Diff line change @@ -72,11 +72,25 @@ - (void)applicationLoadConfiguration {
7272 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults ];
7373
7474 _executable = self.arguments = [defaults stringForKey: @" Executable" ];
75- if (!_executable) {
76- _executable = [NSString stringWithFormat: @" %@ /%@ " ,
75+
76+ // Check that the excutable is valid (not null, exists and is executable)
77+ // If it's not, nullify it so that it will be set to the default value
78+ if (_executable) {
79+ NSFileManager *fileManager = [NSFileManager defaultManager ];
80+ if (![fileManager fileExistsAtPath: _executable]) {
81+ NSLog (@" Resetting Syncthing daemon executable path because it doesn't exist: (%@ )" , _executable);
82+ _executable = nil ;
83+ } else if (![fileManager isExecutableFileAtPath: _executable]) {
84+ NSLog (@" Resetting Syncthing daemon executable path because it's non-executable: (%@ )" , _executable);
85+ _executable = nil ;
86+ }
87+ }
88+
89+ if (!_executable) {
90+ _executable = [NSString stringWithFormat: @" %@ /%@ " ,
7791 [[NSBundle mainBundle ] resourcePath ],
7892 @" syncthing/syncthing" ];
79- }
93+ }
8094
8195 _syncthing.URI = [defaults stringForKey: @" URI" ];
8296 _syncthing.ApiKey = [defaults stringForKey: @" ApiKey" ];
You can’t perform that action at this time.
0 commit comments