File tree Expand file tree Collapse file tree 2 files changed +40
-12
lines changed
src/Files.App/Services/App Expand file tree Collapse file tree 2 files changed +40
-12
lines changed Original file line number Diff line number Diff line change @@ -132,12 +132,26 @@ public async Task CheckAndUpdateFilesLauncherAsync()
132132 if ( ! File . Exists ( destExeFilePath ) )
133133 return ;
134134
135- // Check if the launcher file is associated with the current branch of the app. Users updating from versions earlier than
136- // v4.0.20 will not have the branch file in which case we create it for them.
137- if ( File . Exists ( branchFilePath ) && await File . ReadAllTextAsync ( branchFilePath , Encoding . UTF8 ) != "files-dev" )
138- return ;
139- else if ( ! File . Exists ( branchFilePath ) )
140- await File . WriteAllTextAsync ( branchFilePath , "files-dev" , Encoding . UTF8 ) ;
135+ // Check if the launcher file is associated with the current branch of the app.
136+ if ( File . Exists ( branchFilePath ) )
137+ {
138+ try
139+ {
140+ var branch = await File . ReadAllTextAsync ( branchFilePath , Encoding . UTF8 ) ;
141+ if ( ! string . Equals ( branch . Trim ( ) , "files-dev" , StringComparison . OrdinalIgnoreCase ) )
142+ return ;
143+ }
144+ catch { }
145+ }
146+ else
147+ {
148+ try
149+ {
150+ // Create branch file for users updating from versions earlier than v4.0.20.
151+ await File . WriteAllTextAsync ( branchFilePath , "files-dev" , Encoding . UTF8 ) ;
152+ }
153+ catch { }
154+ }
141155
142156 var srcExeFile = await StorageFile . GetFileFromApplicationUriAsync ( new Uri ( "ms-appx:///Assets/FilesOpenDialog/Files.App.Launcher.exe" ) ) ;
143157 var destFolder = await StorageFolder . GetFolderFromPathAsync ( destFolderPath ) ;
Original file line number Diff line number Diff line change @@ -187,12 +187,26 @@ public async Task CheckAndUpdateFilesLauncherAsync()
187187 if ( ! File . Exists ( destExeFilePath ) )
188188 return ;
189189
190- // Check if the launcher file is associated with the current branch of the app. Users updating from versions earlier than
191- // v4.0.20 will not have the branch file in which case we create it for them.
192- if ( File . Exists ( branchFilePath ) && await File . ReadAllTextAsync ( branchFilePath , Encoding . UTF8 ) != "files-dev" )
193- return ;
194- else if ( ! File . Exists ( branchFilePath ) )
195- await File . WriteAllTextAsync ( branchFilePath , "files-dev" , Encoding . UTF8 ) ;
190+ // Check if the launcher file is associated with the current branch of the app.
191+ if ( File . Exists ( branchFilePath ) )
192+ {
193+ try
194+ {
195+ var branch = await File . ReadAllTextAsync ( branchFilePath , Encoding . UTF8 ) ;
196+ if ( ! string . Equals ( branch . Trim ( ) , "files-dev" , StringComparison . OrdinalIgnoreCase ) )
197+ return ;
198+ }
199+ catch { }
200+ }
201+ else
202+ {
203+ try
204+ {
205+ // Create branch file for users updating from versions earlier than v4.0.20.
206+ await File . WriteAllTextAsync ( branchFilePath , "files-dev" , Encoding . UTF8 ) ;
207+ }
208+ catch { }
209+ }
196210
197211 var srcExeFile = await StorageFile . GetFileFromApplicationUriAsync ( new Uri ( "ms-appx:///Assets/FilesOpenDialog/Files.App.Launcher.exe" ) ) ;
198212 var destFolder = await StorageFolder . GetFolderFromPathAsync ( destFolderPath ) ;
You can’t perform that action at this time.
0 commit comments