Skip to content

Commit b9a37eb

Browse files
committed
Breaking change: Custom project name (from rename project), is now saved under UserSettings/ folder (instead of ProjectSettings/)
So that every user could have their own project names if needed. (that folder is not saved into git)
1 parent e54991a commit b9a37eb

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

UnityLauncherPro/Tools.cs

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,8 @@ public static async void DownloadInBrowser(string version, bool preferFullInstal
694694
// https://beta.unity3d.com/download/330fbefc18b7/UnityDownloadAssistant-6000.1.0a8.exe
695695
if (exeURL == null)
696696
{
697-
Console.WriteLine("TODO DownloadInBrowser");
697+
Console.WriteLine("TODO DownloadInBrowser ,v=" + version);
698+
return;
698699
}
699700

700701
if (preferFullInstaller == true)
@@ -780,6 +781,7 @@ public static async void DownloadAndInstall(string version)
780781
public static async Task DownloadInitScript(string currentInitScriptFullPath, string currentInitScriptLocationOrURL)
781782
{
782783
string currentInitScriptFolder = Path.GetDirectoryName(currentInitScriptFullPath);
784+
783785
string currentInitScriptFile = Path.GetFileName(currentInitScriptFullPath);
784786
string tempFile = Path.Combine(Path.GetTempPath(), currentInitScriptFile);
785787
bool isLocalFile = false;
@@ -1568,26 +1570,39 @@ public static string GetTargetPlatform(string projectPath)
15681570

15691571
public static string ReadCustomProjectData(string projectPath, string customFile)
15701572
{
1571-
string results = null;
1572-
customFile = Path.Combine(projectPath, "ProjectSettings", customFile);
1573-
if (File.Exists(customFile) == true)
1573+
// ProjectSettings is the old deprecated location (and current location from Hub 3.15.x, but later they will use UserSettings first too)
1574+
string[] directories = { "UserSettings", "ProjectSettings" };
1575+
1576+
foreach (var directory in directories)
15741577
{
1575-
results = string.Join(" ", File.ReadAllLines(customFile));
1578+
string filePath = Path.Combine(projectPath, directory, customFile);
1579+
if (File.Exists(filePath))
1580+
{
1581+
return string.Join(" ", File.ReadAllLines(filePath));
1582+
}
15761583
}
1577-
return results;
1584+
1585+
return null;
15781586
}
15791587

15801588
public static bool SaveCustomProjectData(string projectPath, string customFile, string data)
15811589
{
1582-
customFile = Path.Combine(projectPath, "ProjectSettings", customFile);
1590+
// NOTE: now saving into UserSettings folder only (there might be old custom data is in ProjectSettings/ still..)
1591+
var customPath = Path.Combine(projectPath, "UserSettings");
1592+
if (!Directory.Exists(customPath))
1593+
{
1594+
Directory.CreateDirectory(customPath);
1595+
}
15831596

1597+
customFile = Path.Combine(customPath, customFile);
15841598
try
15851599
{
15861600
File.WriteAllText(customFile, data);
15871601
return true;
15881602
}
15891603
catch (Exception)
15901604
{
1605+
SetStatus("Failed to save custom project data to: " + customFile);
15911606
}
15921607

15931608
return false;

0 commit comments

Comments
 (0)