File tree Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Expand file tree Collapse file tree 1 file changed +21
-7
lines changed Original file line number Diff line number Diff line change 2020using System . Windows . Media ;
2121using Flow . Launcher . Infrastructure . Hotkey ;
2222using Flow . Launcher . Plugin . SharedCommands ;
23+ using System . IO ;
2324
2425namespace Flow . Launcher
2526{
@@ -59,18 +60,31 @@ private void OnCopy(object sender, ExecutedRoutedEventArgs e)
5960 {
6061 var results = _viewModel . Results ;
6162 var result = results . SelectedItem ? . Result ;
62- if ( result != null ) // SelectedItem returns null if selection is empty.
63+ if ( result != null )
6364 {
64- string _copyText = String . IsNullOrEmpty ( result . CopyText ) ? result . Title : result . CopyText ;
65- System . Windows . Clipboard . SetDataObject ( _copyText . ToString ( ) ) ;
65+ string copyText = String . IsNullOrEmpty ( result . CopyText ) ? result . SubTitle : result . CopyText ;
66+ if ( File . Exists ( copyText ) || Directory . Exists ( copyText ) )
67+ {
68+
69+ System . Collections . Specialized . StringCollection paths = new System . Collections . Specialized . StringCollection ( ) ;
70+ paths . Add ( copyText ) ;
71+
72+ System . Windows . Clipboard . SetFileDropList ( paths ) ;
73+
74+ }
75+ else
76+ {
77+ System . Windows . Clipboard . SetDataObject ( copyText . ToString ( ) ) ;
78+ }
79+
6680 e . Handled = true ;
6781 }
6882
6983 }
70- // else if (!String.IsNullOrEmpty(QueryTextBox.Text))
71- // {
72- // System.Windows.Clipboard.SetDataObject(QueryTextBox.SelectedText);
73- // }
84+ else if ( ! String . IsNullOrEmpty ( QueryTextBox . Text ) )
85+ {
86+ System . Windows . Clipboard . SetDataObject ( QueryTextBox . SelectedText ) ;
87+ }
7488 e . Handled = false ;
7589 }
7690 private async void OnClosing ( object sender , CancelEventArgs e )
You can’t perform that action at this time.
0 commit comments