BuildReportTool.Util.GetEditorLogFileInWindows C# (CSharp) Method

GetEditorLogFileInWindows() static private method

static private GetEditorLogFileInWindows ( string editorFilename = "Editor.log" ) : string
editorFilename string
return string
	static string GetEditorLogFileInWindows(string editorFilename = "Editor.log")
	{
		string editorLogSubPath = "/Unity/Editor/" + editorFilename;

		// try getting from LOCALAPPDATA
		// this is the one used from after Windows XP

		string localAppDataVar = System.Environment.GetEnvironmentVariable("LOCALAPPDATA");

		if (!string.IsNullOrEmpty(localAppDataVar))
		{
			string nonXpStyleAppDataPath = localAppDataVar.Replace("\\", "/");
			if (Directory.Exists(nonXpStyleAppDataPath))
			{
				return nonXpStyleAppDataPath + editorLogSubPath;
			}
		}

		// didn't find it in LOCALAPPDATA
		// try USERPROFILE (WinXP style)

		string userProfileVar = System.Environment.GetEnvironmentVariable("USERPROFILE");

		if (!string.IsNullOrEmpty(userProfileVar))
		{
			string xpStyleAppDataPath = userProfileVar.Replace("\\", "/") + "/Local Settings/Application Data";
			if (Directory.Exists(xpStyleAppDataPath))
			{
				return xpStyleAppDataPath + editorLogSubPath;
			}
		}

		Debug.LogError("Could not find path to Unity Editor log!");

		return "";
	}