/// <summary> /// Creates clone of the project located at the given path. /// </summary> /// <param name="sourceProjectPath"></param> /// <returns></returns> public static Project CreateCloneFromPath(string sourceProjectPath) { Project sourceProject = new Project(sourceProjectPath); Project cloneProject = new Project(sourceProjectPath + ProjectCloner.CloneNameSuffix); Debug.Log("Start project name: " + sourceProject); Debug.Log("Clone project name: " + cloneProject); ProjectCloner.CreateProjectFolder(cloneProject); ProjectCloner.CopyLibraryFolder(sourceProject, cloneProject); ProjectCloner.LinkFolders(sourceProject.assetPath, cloneProject.assetPath); ProjectCloner.LinkFolders(sourceProject.projectSettingsPath, cloneProject.projectSettingsPath); ProjectCloner.LinkFolders(sourceProject.packagesPath, cloneProject.packagesPath); ProjectCloner.LinkFolders(sourceProject.autoBuildPath, cloneProject.autoBuildPath); ProjectCloner.RegisterClone(cloneProject); return(cloneProject); }
/// <summary> /// Creates clone of the project located at the given path. /// </summary> /// <param name="sourceProjectPath"></param> /// <returns></returns> public static Project CreateCloneFromPath(string sourceProjectPath) { Project sourceProject = new Project(sourceProjectPath); string cloneProjectPath = null; //Find available clone suffix id for (int i = 0; i < MaxCloneProjectCount; i++) { string originalProjectPath = ProjectCloner.GetCurrentProject().projectPath; string possibleCloneProjectPath = originalProjectPath + ProjectCloner.CloneNameSuffix + "_" + i; if (!Directory.Exists(possibleCloneProjectPath)) { cloneProjectPath = possibleCloneProjectPath; break; } } if (string.IsNullOrEmpty(cloneProjectPath)) { Debug.LogError("The number of cloned projects has reach its limit. Limit: " + MaxCloneProjectCount); return(null); } Project cloneProject = new Project(cloneProjectPath); Debug.Log("Start project name: " + sourceProject); Debug.Log("Clone project name: " + cloneProject); ProjectCloner.CreateProjectFolder(cloneProject); ProjectCloner.CopyLibraryFolder(sourceProject, cloneProject); ProjectCloner.LinkFolders(sourceProject.assetPath, cloneProject.assetPath); ProjectCloner.LinkFolders(sourceProject.projectSettingsPath, cloneProject.projectSettingsPath); ProjectCloner.LinkFolders(sourceProject.packagesPath, cloneProject.packagesPath); ProjectCloner.LinkFolders(sourceProject.autoBuildPath, cloneProject.autoBuildPath); ProjectCloner.RegisterClone(cloneProject); return(cloneProject); }