@@ -92,9 +92,10 @@ private IEnumerator PreparePatchAndRestart()
92
92
if ( Directory . Exists ( cacheDir ) ) {
93
93
DeleteDirectory ( cacheDir ) ;
94
94
}
95
- else
95
+
96
+ if ( Directory . Exists ( cacheDir ) )
96
97
{
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 ( ) ; } ) ;
98
99
yield break ;
99
100
}
100
101
@@ -115,25 +116,36 @@ private IEnumerator Restart()
115
116
116
117
public static void DeleteDirectory ( string target_dir )
117
118
{
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 ) ;
122
121
123
- foreach ( string file in files )
122
+ foreach ( string file in files )
123
+ {
124
+ try
124
125
{
126
+ Debug . Log ( "deleting file:" + file ) ;
125
127
File . SetAttributes ( file , FileAttributes . Normal ) ;
126
128
File . Delete ( file ) ;
129
+ Debug . Log ( "deleted file:" + file ) ;
127
130
}
128
-
129
- foreach ( string dir in dirs )
131
+ catch ( System . Exception e )
130
132
{
131
- DeleteDirectory ( dir ) ;
133
+ Debug . LogException ( e ) ;
132
134
}
135
+ }
133
136
137
+ foreach ( string dir in dirs )
138
+ {
139
+ DeleteDirectory ( dir ) ;
140
+ }
141
+
142
+ try
143
+ {
144
+ Debug . Log ( "deleting dir:" + target_dir ) ;
134
145
Directory . Delete ( target_dir , false ) ;
146
+ Debug . Log ( "deleted dir:" + target_dir ) ;
135
147
}
136
- catch ( System . Exception e )
148
+ catch ( System . Exception e )
137
149
{
138
150
Debug . LogException ( e ) ;
139
151
}
0 commit comments