@@ -221,9 +221,29 @@ public static void SetDir(string name, Dir model)
221
221
{
222
222
string currentPath = Path . Combine ( Utils . NodeDataParent ( name ) , name ) ;
223
223
string requestPath = Path . Combine ( model . Path , name ) ;
224
- Directory . Move ( currentPath , requestPath ) ;
224
+ CopyFolder ( currentPath , requestPath ) ;
225
225
string filePath = Path . Combine ( Utils . appDataDir , $ "{ name } .data") ;
226
226
File . WriteAllText ( filePath , model . Path ) ;
227
+ Directory . Delete ( currentPath , true ) ;
228
+ }
229
+
230
+ public static void CopyFolder ( string sourceFolder , string destFolder )
231
+ {
232
+ Directory . CreateDirectory ( destFolder ) ;
233
+ string [ ] files = Directory . GetFiles ( sourceFolder ) ;
234
+ foreach ( string file in files )
235
+ {
236
+ string name = Path . GetFileName ( file ) ;
237
+ string dest = Path . Combine ( destFolder , name ) ;
238
+ File . Copy ( file , dest ) ;
239
+ }
240
+ string [ ] folders = Directory . GetDirectories ( sourceFolder ) ;
241
+ foreach ( string folder in folders )
242
+ {
243
+ string name = Path . GetFileName ( folder ) ;
244
+ string dest = Path . Combine ( destFolder , name ) ;
245
+ CopyFolder ( folder , dest ) ;
246
+ }
227
247
}
228
248
229
249
public static async Task EnableTelemetry ( string name )
0 commit comments