vladimir-tikhonov / tree-view-copy-relative-path

https://atom.io/packages/tree-view-copy-relative-path
MIT License
15 stars 8 forks source link

"copy relative path" command has no effect when no files are open #7

Closed davidacreates closed 7 years ago

davidacreates commented 7 years ago

Atom: 1.18.0-beta0 OS: Sierra 10.12.4 Thrown From: tree-view-copy-relative-path package 1.1.0

I made a gif of what I am experiencing when I try to copy the relative path.

http://cloud.orangemooncreative.com/431j132t3O1T

rscott78 commented 7 years ago

I'm also having this issue - it just started within the last day or two.

Atom: 1.17.0x64 OS: Windows 10

slyy commented 7 years ago

Same here :(

MacOS Sierra 10.12.3 Atom: 1.17.0 Package 1.1.0

danielcaldas commented 7 years ago

Same here. This happened after upgrading for atom 1.17.0 :/

danielcaldas commented 7 years ago

I took a look and it seems like something is wrong with atom.workspace.getActivePaneItem()

copyRelativePath: (treeViewPath) ->
    return if not treeViewPath

    # Here, currentPath is giving undefined
    currentPath = atom.workspace.getActivePaneItem()?.buffer?.file?.path
    unless currentPath
      atom.notifications.addWarning '"Copy Relative Path" command
        has no effect when no files are open'
      return
danielcaldas commented 7 years ago

@orangemooncreative @rscott78 @slyy, for this to work properly just change:

currentPath = atom.workspace.getActivePaneItem()?.buffer?.file?.path

to:

currentPath = atom.workspace?.paneContainers?.center?.paneContainer?.activePane?.activeItem?.buffer?.file?.path
vladimir-tikhonov commented 7 years ago

Should be fixed in v1.2.0, could someone confirm please?

danielcaldas commented 7 years ago

@vladimir-tikhonov Just tried it. Works good for me with v1.2.0 :+1:

davidacreates commented 7 years ago

@vladimir-tikhonov works great. thanks!