@@ -18,7 +18,6 @@ public static class SampleSetup
1818 private const string CANCEL_BUTTON_TEXT = "Cancel" ;
1919
2020 private const string RPM_WEBGL_SCREEN_SHOWN_KEY = "rpm-webgl-screen-shown" ;
21- private const string TEMPLATE_PATH = "WebGLTemplates" ;
2221 private const string FILE_NAME = "ReadyPlayerMe.Core.WebGLSample.asmdef" ;
2322 private const string PLUGINS_FOLDER = "Plugins" ;
2423 private const string WEBGL_HELPER_PATH = "WebGlHelper" ;
@@ -61,8 +60,8 @@ private static void OnConfirm()
6160 Debug . LogWarning ( "Failed to find WebGLSample. No changes were done to project" ) ;
6261 return ;
6362 }
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 } ") ;
6665 SetWebGLTemplate ( ) ;
6766 }
6867
@@ -77,7 +76,7 @@ private static string GetSampleRootFolder()
7776 return rootSamplePath . TrimEnd ( '/' ) ;
7877 }
7978
80- private static void CopyPath ( string sourcePath , string destinationPath )
79+ private static void MoveFolder ( string sourcePath , string destinationPath )
8180 {
8281 // Extract the last part of the source path (e.g., "Plugin")
8382 string sourceDirectoryName = new DirectoryInfo ( sourcePath ) . Name ;
@@ -91,29 +90,14 @@ private static void CopyPath(string sourcePath, string destinationPath)
9190 throw new DirectoryNotFoundException ( "Source directory does not exist or could not be found: " + sourcePath ) ;
9291 }
9392
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 ) )
9695 {
97- Directory . CreateDirectory ( newDestinationPath ) ;
96+ Directory . CreateDirectory ( destinationPath ) ;
9897 }
9998
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 ) ;
117101 }
118102
119103 private static void SetWebGLTemplate ( )
0 commit comments