Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc5f2707

Browse files
committed
fixing plastic branch parsing#185
1 parent1420ae8 commitc5f2707

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

‎UnityLauncherPro/GetProjects.cs‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public static List<Project> Scan(bool getGitBranch = false, bool getPlasticBranc
120120
returnprojectsFound;
121121
}// Scan()
122122

123-
staticProjectGetProjectInfo(stringprojectPath,boolgetGitBranch=false,boolgetPlasticBranch=false,boolgetArguments=false,boolshowMissingFolders=false,boolshowTargetPlatform=false,boolsearchGitbranchRecursivly=false,boolshowSRP=false)
123+
staticProjectGetProjectInfo(stringprojectPath,boolgetGitBranch=false,boolgetPlasticBranch=false,boolgetArguments=false,boolshowMissingFolders=false,boolshowTargetPlatform=false,boolsearchGitbranchRecursively=false,boolshowSRP=false)
124124
{
125125
boolfolderExists=Directory.Exists(projectPath);
126126

@@ -165,7 +165,8 @@ static Project GetProjectInfo(string projectPath, bool getGitBranch = false, boo
165165
stringgitBranch="";
166166
if(getGitBranch==true)
167167
{
168-
gitBranch=folderExists?Tools.ReadGitBranchInfo(projectPath,searchGitbranchRecursivly):null;
168+
gitBranch=folderExists?Tools.ReadGitBranchInfo(projectPath,searchGitbranchRecursively):null;
169+
169170
// check for plastic, if enabled
170171
if(getPlasticBranch==true&&gitBranch==null)
171172
{

‎UnityLauncherPro/Tools.cs‎

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,12 +1424,9 @@ public static string ReadGitBranchInfo(string projectPath, bool searchParentFold
14241424
{
14251425
stringdirName=Path.Combine(projectPath,".git");
14261426
if(Directory.Exists(dirName))
1427-
1428-
14291427
{
14301428
stringbranchFile=Path.Combine(dirName,"HEAD");
14311429
if(File.Exists(branchFile))
1432-
14331430
{
14341431
// removes extra end of line
14351432
results=string.Join(" ",File.ReadAllLines(branchFile));
@@ -1438,30 +1435,40 @@ public static string ReadGitBranchInfo(string projectPath, bool searchParentFold
14381435
results=results.Substring(pos,results.Length-pos);
14391436

14401437
}
1441-
14421438
}
14431439
}
14441440
returnresults;
14451441
}
14461442

14471443
publicstaticstringReadPlasticBranchInfo(stringprojectPath)
14481444
{
1449-
stringresults=null;
1450-
stringdirName=Path.Combine(projectPath,".plastic");
1451-
if(Directory.Exists(dirName))
1445+
stringbranchName=null;
1446+
stringplasticSelectorPath=Path.Combine(projectPath,".plastic","plastic.selector");
1447+
1448+
if(File.Exists(plasticSelectorPath))
14521449
{
1453-
stringbranchFile=Path.Combine(dirName,"plastic.selector");
1454-
if(File.Exists(branchFile))
1450+
string[]lines=File.ReadAllLines(plasticSelectorPath);
1451+
foreach(stringlineinlines)
14551452
{
1456-
// removes extra end of line
1457-
results=string.Join(" ",File.ReadAllText(branchFile));
1458-
// get branch only
1459-
intpos=results.LastIndexOf("\"/")+1;
1460-
// -1 to remove last "
1461-
results=results.Substring(pos,results.Length-pos-1);
1453+
stringtrimmedLine=line.Trim();
1454+
if(trimmedLine.StartsWith("br ")||trimmedLine.StartsWith("smartbranch "))
1455+
{
1456+
// Extract the branch name between quotes
1457+
varmatch=Regex.Match(trimmedLine,"\"([^\"]+)\"");
1458+
if(match.Success)
1459+
{
1460+
branchName=match.Groups[1].Value;
1461+
// Remove the leading slash if present
1462+
if(branchName.StartsWith("/"))
1463+
{
1464+
branchName=branchName.Substring(1);
1465+
}
1466+
break;
1467+
}
1468+
}
14621469
}
14631470
}
1464-
returnresults;
1471+
returnbranchName;
14651472
}
14661473

14671474
//public static Platform GetTargetPlatform(string projectPath)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp