This repository was archived by the owner on Oct 3, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +25
-10
lines changed
Expand file tree Collapse file tree 2 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -128,20 +128,35 @@ private static void InstallUpdate(
128128
129129 // delete the old YAMDCC installation
130130 dlg . Caption = "Installing YAMDCC update..." ;
131- DirectoryInfo di = new ( destPath ) ;
132- foreach ( FileInfo fi in di . GetFiles ( ) )
131+ DirectoryInfo di ;
132+ try
133133 {
134- fi . Delete ( ) ;
135- }
136- foreach ( DirectoryInfo dir in di . GetDirectories ( ) )
137- {
138- if ( dir . FullName != confPath &&
139- dir . FullName != oldPath &&
140- dir . FullName != updatePath )
134+ di = new ( destPath ) ;
135+ foreach ( FileInfo fi in di . GetFiles ( ) )
136+ {
137+ fi . Delete ( ) ;
138+ }
139+ foreach ( DirectoryInfo dir in di . GetDirectories ( ) )
141140 {
142- dir . Delete ( true ) ;
141+ if ( dir . FullName != confPath &&
142+ dir . FullName != oldPath &&
143+ dir . FullName != updatePath )
144+ {
145+ dir . Delete ( true ) ;
146+ }
143147 }
144148 }
149+ catch ( UnauthorizedAccessException ex )
150+ {
151+ Utils . ShowError (
152+ "Failed to delete old YAMDCC installation.\n " +
153+ "This probably means something else has YAMDCC's files open.\n " +
154+ "See issue #62 on the YAMDCC GitHub for more info.\n \n " +
155+ "Details:\n " +
156+ $ "{ ex . GetType ( ) } : { ex . Message } \n " +
157+ $ "{ ex . StackTrace } ") ;
158+ return false ;
159+ }
145160
146161 // move updated YAMDCC into place
147162 di = new ( updatePath ) ;
You can’t perform that action at this time.
0 commit comments