Skip to content

Commit ec8b7ca

Browse files
committed
fix browse Script and Theme folder buttons
1 parent e98ed72 commit ec8b7ca

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

Diff for: UnityLauncherPro/MainWindow.xaml.cs

+14-6
Original file line numberDiff line numberDiff line change
@@ -1495,7 +1495,7 @@ private void BtnDownloadInBrowserFull_Click(object sender, RoutedEventArgs e)
14951495
string url = Tools.GetUnityReleaseURL(unity?.Version);
14961496
if (string.IsNullOrEmpty(url) == false)
14971497
{
1498-
Tools.DownloadInBrowser(url, unity.Version,true);
1498+
Tools.DownloadInBrowser(url, unity.Version, true);
14991499
}
15001500
else
15011501
{
@@ -2607,7 +2607,11 @@ private void TxtCustomThemeFile_PreviewKeyDown(object sender, KeyEventArgs e)
26072607

26082608
private void BtnExploreFolder_Click(object sender, RoutedEventArgs e)
26092609
{
2610-
Tools.LaunchExplorer(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Themes"));
2610+
var path = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Themes");
2611+
if (Tools.LaunchExplorer(path) == false)
2612+
{
2613+
Tools.LaunchExplorer(AppDomain.CurrentDomain.BaseDirectory);
2614+
}
26112615
}
26122616

26132617
private void ChkEnablePlatformSelection_Checked(object sender, RoutedEventArgs e)
@@ -3233,13 +3237,17 @@ public int Compare(Object a, Object b)
32333237
}
32343238
}
32353239

3236-
3237-
32383240
private void btnExploreScriptsFolder_Click(object sender, RoutedEventArgs e)
32393241
{
3240-
if (Tools.LaunchExplorer(initScriptFileFullPath) == false)
3242+
if (Tools.LaunchExplorer(Path.GetDirectoryName(initScriptFileFullPath)) == false)
32413243
{
3242-
Tools.LaunchExplorer(Path.GetDirectoryName(initScriptFileFullPath));
3244+
// if failed, open parent folder (probably path was using URL or no scripts yet)
3245+
var parentPath = Directory.GetParent(Path.GetDirectoryName(initScriptFileFullPath)).FullName;
3246+
if (Tools.LaunchExplorer(parentPath) == false)
3247+
{
3248+
// if still failed, open exe folder
3249+
Tools.LaunchExplorer(AppDomain.CurrentDomain.BaseDirectory);
3250+
}
32433251
}
32443252
}
32453253

0 commit comments

Comments
 (0)