Skip to content

Commit df871cb

Browse files
committed
add right click menu: copy project path (can use in save dialogs with other programs)
1 parent 48976a0 commit df871cb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Diff for: UnityLauncherPro/MainWindow.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@
327327
<DataGrid.ContextMenu>
328328
<ContextMenu>
329329
<MenuItem x:Name="menuItemCopyVersion" Header="Copy Unity Version" Click="MenuItemCopyVersion_Click" />
330+
<MenuItem x:Name="menuItemCopyPath" Header="Copy Project Path" Click="MenuItemCopyPath_Click" />
330331
<!--<Separator />-->
331332
<MenuItem x:Name="menuItemShowProjectInExplorer" Header="Show in Explorer" Click="MenuItemShowProjectInExplorer_Click" />
332333
</ContextMenu>

Diff for: UnityLauncherPro/MainWindow.xaml.cs

+12
Original file line numberDiff line numberDiff line change
@@ -1127,5 +1127,17 @@ private void Window_Activated(object sender, EventArgs e)
11271127
//Console.WriteLine("gridRecent.IsFocused=" + gridRecent.IsFocused);
11281128
//Console.WriteLine("gridRecent.IsFocused=" + gridRecent.IsKeyboardFocused);
11291129
}
1130+
1131+
private void MenuItemCopyPath_Click(object sender, RoutedEventArgs e)
1132+
{
1133+
string copy = null;
1134+
if (tabControl.SelectedIndex == 0)
1135+
{
1136+
var proj = GetSelectedProject();
1137+
// fix slashes so that it works in save dialogs
1138+
copy = proj?.Path.Replace('/','\\');
1139+
}
1140+
if (copy != null) Clipboard.SetText(copy);
1141+
}
11301142
} // class
11311143
} //namespace

0 commit comments

Comments
 (0)