Skip to content

Commit d559760

Browse files
author
Stephen Hodgson
committed
Added a way to view the local log file if building to VR
1 parent d9d2931 commit d559760

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

Assets/HoloToolkit/BuildAndDeploy/Editor/BuildDeployWindow.cs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ private bool ShouldWebPortalBeEnabled
6969

7070
private bool ShouldLogViewBeEnabled
7171
{
72-
get { return !string.IsNullOrEmpty(BuildDeployPrefs.TargetIPs) && !string.IsNullOrEmpty(BuildDeployPrefs.BuildDirectory); }
72+
get { return !string.IsNullOrEmpty(BuildDeployPrefs.BuildDirectory); }
7373
}
7474

7575
private bool LocalIPsOnly { get { return true; } }
@@ -683,12 +683,31 @@ private void OnGUI()
683683
// Log file
684684
using (new EditorGUILayout.HorizontalScope())
685685
{
686-
GUI.enabled = ShouldLogViewBeEnabled && (!locatorIsSearching && locatorHasData || HoloLensUsbConnected);
686+
string localLogPath = string.Empty;
687+
bool localLogExists = false;
688+
689+
bool remoteDeviceDetected = !locatorIsSearching && locatorHasData || HoloLensUsbConnected && !string.IsNullOrEmpty(BuildDeployPrefs.TargetIPs);
690+
bool isLocalBuild = BuildDeployPrefs.BuildPlatform == BuildPlatformEnum.x64.ToString();
691+
if (!remoteDeviceDetected)
692+
{
693+
localLogPath = string.Format("%USERPROFILE%\\AppData\\Local\\Packages\\{0}\\TempState\\UnityPlayer.log", PlayerSettings.productName);
694+
localLogExists = File.Exists(localLogPath);
695+
}
696+
697+
GUI.enabled = ShouldLogViewBeEnabled && (remoteDeviceDetected || isLocalBuild && localLogExists);
687698
GUILayout.FlexibleSpace();
688699

700+
689701
if (GUILayout.Button("View Log File", GUILayout.Width(buttonWidth_Full)))
690702
{
691-
OpenLogFileForIPs(curTargetIps);
703+
if (remoteDeviceDetected)
704+
{
705+
OpenLogFileForIPs(curTargetIps);
706+
}
707+
else
708+
{
709+
Process.Start(localLogPath);
710+
}
692711
}
693712

694713
GUI.enabled = true;

0 commit comments

Comments
 (0)