8000 Fixed a problem with unique clone names by mmikleusevic · Pull Request #121 · VeriorPies/ParrelSync · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fixed a problem with unique clone names #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions ParrelSync/Editor/ClonesManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public static Project CreateCloneFromPath(string sourceProjectPath)
string cloneProjectPath = null;

//Find available clone suffix id
int availableCloneSuffixId = 0;
for (int i = 0; i < MaxCloneProjectCount; i++)
{
string originalProjectPath = ClonesManager.GetCurrentProject().projectPath;
Expand All @@ -84,6 +85,7 @@ public static Project CreateCloneFromPath(string sourceProjectPath)
if (!Directory.Exists(possibleCloneProjectPath))
{
cloneProjectPath = possibleCloneProjectPath;
availableCloneSuffixId = i;
break;
}
}
Expand Down Expand Up @@ -133,7 +135,7 @@ public static Project CreateCloneFromPath(string sourceProjectPath)
LinkFolders(sourceOptionalPath, cloneOptionalPath);
}

ClonesManager.RegisterClone(cloneProject);
ClonesManager.RegisterClone(cloneProject, availableCloneSuffixId);

return cloneProject;
}
Expand All @@ -142,15 +144,15 @@ public static Project CreateCloneFromPath(string sourceProjectPath)
/// Registers a clone by placing an identifying ".clone" file in its root directory.
/// </summary>
/// <param name="cloneProject"></param>
private static void RegisterClone(Project cloneProject)
private static void RegisterClone(Project cloneProject, int availableCloneSuffixId)
{
/// Add clone identifier file.
string identifierFile = Path.Combine(cloneProject.projectPath, ClonesManager.CloneFileName);
File.Create(identifierFile).Dispose();

//Add argument file with default argument
string argumentFilePath = Path.Combine(cloneProject.projectPath, ClonesManager.ArgumentFileName);
File.WriteAllText(argumentFilePath, DefaultArgument, System.Text.Encoding.UTF8);
File.WriteAllText(argumentFilePath, DefaultArgument + availableCloneSuffixId, System.Text.Encoding.UTF8);

/// Add collabignore.txt to stop the clone from messing with Unity Collaborate if it's enabled. Just in case.
string collabignoreFile = Path.Combine(cloneProject.projectPath, "collabignore.txt");
Expand Down
309E
0