@@ -18,7 +18,6 @@ public static class SampleSetup
18
18
private const string CANCEL_BUTTON_TEXT = "Cancel" ;
19
19
20
20
private const string RPM_WEBGL_SCREEN_SHOWN_KEY = "rpm-webgl-screen-shown" ;
21
- private const string TEMPLATE_PATH = "WebGLTemplates" ;
22
21
private const string FILE_NAME = "ReadyPlayerMe.Core.WebGLSample.asmdef" ;
23
22
private const string PLUGINS_FOLDER = "Plugins" ;
24
23
private const string WEBGL_HELPER_PATH = "WebGlHelper" ;
@@ -61,8 +60,8 @@ private static void OnConfirm()
61
60
Debug . LogWarning ( "Failed to find WebGLSample. No changes were done to project" ) ;
62
61
return ;
63
62
}
64
- CopyContents ( $ "{ samplesRootFolder } /{ TEMPLATE_PATH } ", $ "{ Application . dataPath } ") ;
65
- CopyContents ( $ "{ samplesRootFolder } /{ WEBGL_HELPER_PATH } ", $ "{ Application . dataPath } /{ PLUGINS_FOLDER } ") ;
63
+ MoveFolder ( $ "{ samplesRootFolder } /{ TEMPLATE_PATH } ", $ "{ Application . dataPath } ") ;
64
+ MoveFolder ( $ "{ samplesRootFolder } /{ WEBGL_HELPER_PATH } ", $ "{ Application . dataPath } /{ PLUGINS_FOLDER } ") ;
66
65
SetWebGLTemplate ( ) ;
67
66
}
68
67
@@ -77,7 +76,7 @@ private static string GetSampleRootFolder()
77
76
return rootSamplePath . TrimEnd ( '/' ) ;
78
77
}
79
78
80
- private static void CopyPath ( string sourcePath , string destinationPath )
79
+ private static void MoveFolder ( string sourcePath , string destinationPath )
81
80
{
82
81
// Extract the last part of the source path (e.g., "Plugin")
83
82
string sourceDirectoryName = new DirectoryInfo ( sourcePath ) . Name ;
@@ -91,29 +90,14 @@ private static void CopyPath(string sourcePath, string destinationPath)
91
90
throw new DirectoryNotFoundException ( "Source directory does not exist or could not be found: " + sourcePath ) ;
92
91
}
93
92
94
- // Check if the new destination directory exists, if not , create it
95
- if ( ! Directory . Exists ( newDestinationPath ) )
93
+ // If the destination directory doesn't exist , create it
94
+ if ( ! Directory . Exists ( destinationPath ) )
96
95
{
97
- Directory . CreateDirectory ( newDestinationPath ) ;
96
+ Directory . CreateDirectory ( destinationPath ) ;
98
97
}
99
98
100
- // Get the files in the directory and copy them to the new location
101
- string [ ] files = Directory . GetFiles ( sourcePath ) ;
102
- foreach ( string file in files )
103
- {
104
- string fileName = Path . GetFileName ( file ) ;
105
- string destFile = Path . Combine ( newDestinationPath , fileName ) ;
106
- File . Copy ( file , destFile , true ) ; // true to overwrite if file already exists
107
- }
108
-
109
- // If copying subdirectories, copy them and their contents to new location
110
- string [ ] subdirectories = Directory . GetDirectories ( sourcePath ) ;
111
- foreach ( string subdirectory in subdirectories )
112
- {
113
- string subdirectoryName = Path . GetFileName ( subdirectory ) ;
114
- string finalDestinationPath = Path . Combine ( newDestinationPath , subdirectoryName ) ;
115
- CopyPath ( subdirectory , finalDestinationPath ) ; // Recursively copy subdirectories
116
- }
99
+ // Move the entire source directory to the new destination
100
+ Directory . Move ( sourcePath , newDestinationPath ) ;
117
101
}
118
102
119
103
private static void SetWebGLTemplate ( )
0 commit comments