Is there a way to know if a command was called from tree-view context menu or current file?
I’m creating a package that adds context menu to tree-view and also to active pane (current file). So, when I call a command, I need to know the file path, so I do this to active pane
filePath = atom.workspace.getActivePaneItem?().getPath?()
but for the tree-view, I use this
filePath = atom.workspaceView.find('.tree-view .selected').views()?.getPath?()
I need this different code in tree-view because the user can use the right-click on files (other than that being edited) and I need to call the command for that file. Otherwise, I had to add two different commands, one for the editor and other for the tree-view, and both becomes available on Command Palette
Thanks in advance