How to get full paths from link text

It’s kind of hard to help when you don’t say anything about how and where you want to get this information. It doesn’t provide us with any hints as to what’s available for you to use.

That you want to use it in a call to addCommand() doesn’t really tell anything.

However, it might be that getFirstlinkPathDest(linkpath, sourcePath) could work for you.

Another option if you’re using dataview could be to use dv.page() to get the full metadata on a given page. This also includes a full path to the page it retrieved.

Here are two examples where I’m looking for the a note called 2022-11-22 in my test vault (and it happens to exists multiple times):

```dataviewjs

const metaVariant = app.metadataCache.getFirstLinkpathDest("2022-11-22", "")
dv.paragraph("getFirstLinkpathDest:   " + metaVariant.path)

const dvPageVariant = dv.page("2022-11-22")

dv.span("dv.page: " + dvPageVariant.file.path)
```

In my test vault this produced this output:

Another similar variant would be the getLinkpathDest() which returns all matches against the given name.

const metaVariant = app.metadataCache.getLinkpathDest("2022-11-22", "")
dv.list(metaVariant.map(p => p.path))

Which for me produced:
image

The second parameter to the linkpath dest functions is the path to the file. If omitted or wrong, they’ll return the first and best. If fully specified, then that version of the file is picked. (Note, I’ve not used these functions a lot, so I don’t know which caveats there are related to using either of them )