@@ -92,9 +92,10 @@ private IEnumerator PreparePatchAndRestart()
9292 if ( Directory . Exists ( cacheDir ) ) {
9393 DeleteDirectory ( cacheDir ) ;
9494 }
95- else
95+
96+ if ( Directory . Exists ( cacheDir ) )
9697 {
97- messageBox . Show ( "pre Unity cached file not found . path:" + cacheDir , "ok" , ( ) => { messageBox . Close ( ) ; } ) ;
98+ messageBox . Show ( "failed to delete pre Unity cached file. path:" + cacheDir , "ok" , ( ) => { messageBox . Close ( ) ; } ) ;
9899 yield break ;
99100 }
100101
@@ -115,25 +116,36 @@ private IEnumerator Restart()
115116
116117 public static void DeleteDirectory ( string target_dir )
117118 {
118- try
119- {
120- string [ ] files = Directory . GetFiles ( target_dir ) ;
121- string [ ] dirs = Directory . GetDirectories ( target_dir ) ;
119+ string [ ] files = Directory . GetFiles ( target_dir ) ;
120+ string [ ] dirs = Directory . GetDirectories ( target_dir ) ;
122121
123- foreach ( string file in files )
122+ foreach ( string file in files )
123+ {
124+ try
124125 {
126+ Debug . Log ( "deleting file:" + file ) ;
125127 File . SetAttributes ( file , FileAttributes . Normal ) ;
126128 File . Delete ( file ) ;
129+ Debug . Log ( "deleted file:" + file ) ;
127130 }
128-
129- foreach ( string dir in dirs )
131+ catch ( System . Exception e )
130132 {
131- DeleteDirectory ( dir ) ;
133+ Debug . LogException ( e ) ;
132134 }
135+ }
133136
137+ foreach ( string dir in dirs )
138+ {
139+ DeleteDirectory ( dir ) ;
140+ }
141+
142+ try
143+ {
144+ Debug . Log ( "deleting dir:" + target_dir ) ;
134145 Directory . Delete ( target_dir , false ) ;
146+ Debug . Log ( "deleted dir:" + target_dir ) ;
135147 }
136- catch ( System . Exception e )
148+ catch ( System . Exception e )
137149 {
138150 Debug . LogException ( e ) ;
139151 }
0 commit comments