@@ -17,12 +17,12 @@ private static void InitializeOnLoad()
17
17
{
18
18
Reset ( ) ;
19
19
}
20
-
21
- public static void CopyPath ( string source , string target )
20
+
21
+ public static void HandleActionFileRecursive ( string source , string target , ActionCallback actionCallback )
22
22
{
23
23
if ( File . Exists ( source ) )
24
24
{
25
- File . Copy ( source , target , true ) ;
25
+ actionCallback ( source , target ) ;
26
26
}
27
27
else if ( Directory . Exists ( source ) )
28
28
{
@@ -32,14 +32,24 @@ public static void CopyPath(string source, string target)
32
32
filesAndDirs . AddRange ( Directory . GetDirectories ( source ) ) ;
33
33
foreach ( string path in filesAndDirs )
34
34
{
35
- CopyPath ( path , Path . Combine ( target , Path . GetFileName ( path ) ) ) ;
35
+ HandleActionFileRecursive ( path , Path . Combine ( target , Path . GetFileName ( path ) ) , actionCallback ) ;
36
36
}
37
37
}
38
38
}
39
39
40
+ public static void CopyWithOverwrite ( string source , string target )
41
+ {
42
+ File . Copy ( source , target , true ) ;
43
+ }
44
+
45
+ public static void CopyPath ( string source , string target )
46
+ {
47
+ HandleActionFileRecursive ( source , target , CopyWithOverwrite ) ;
48
+ }
49
+
40
50
public static void MovePath ( string source , string target )
41
51
{
42
- CopyPath ( source , target ) ;
52
+ HandleActionFileRecursive ( source , target , File . Move ) ;
43
53
DeletePath ( source ) ;
44
54
}
45
55
0 commit comments