Symbolic Links

TrevorAdobe Extensions, CMD / Terminal, Extensions, Tips1 Comment

What are symbolic links?

REALLY OVER SIMPLIFIED they are hyped-up shortcut files that placed in one folder (the destination) point to a file or folder (the source) and are treated as the source.
There are many different types of symbolic links and you can Google to find out the differences between the different types and the difference between them and regular shortcut / link files.

Why would you want to use symbolic links?
  • For extension development it makes no sense to keep your repositories in app folders 😜.
  • Changes in the extensions will be reflected without the need to reinstall the extensions.
    You can add a restart "button" to the extension's html and then you don't even need to restart the app.
    One can normally use something as simple as <a href="./index.html"> Restart </a>.
  • The system extension folder require Admin rights which can be a real pain for a development environment, if the a symbolic link is used one doesn't need Admin rights to make changes to the extension. (Another simple workaround is to use the user level extensions folder see Where to plonk my Adobe extensions?)
How can we setup symbolic links?

There are various user interface tools but it really quick and simple to do so from terminal and CMD.

For Mac the rule is Command "path to original" "path to link"
Which Command do we need to use? ln -s.
So that will be ln -s "path to original" "path to link"

Mac User Folder Example You do not need admin rights for this so no need to use sudo.

ln -s "/Repositories/Fab/com.creative-scripts.FabExt" "/Users/USERNAME/Library/Application Support/Adobe/CEP/extensions/FabExt"

Mac System Folder Example You need admin rights for this so you need to use sudo.

sudo ln -s "/Repositories/Fab/com.creative-scripts.FabExt" "/Library/Application Support/Adobe/CEP/extensions/FabExt"

Change the "path to original" and "path to link" as needed

To "Quote" or not to quote, that is the question?

If paths have spaces in them like /Library/Application Support the paths should be
quoted "/Library/Application Support"
or escaped /Library/Application\ Support
If they are both quoted and escaped then the path will be invalid.

How to easily copy the file paths?

Either drag the file from Finder into the terminal window.
The escaped path will be pasted into the window and you should NOT use quotes.

Or select the file in Finder and press ⌥⌘+C
The unescaped path will be copied and you should use quotes when you paste it into the terminal window.

For Windows the rule is Command "path to link" "path to original"
Which Command do we need to use? mklink /D.
So that will be mklink /D "path to link" "path to original"
Prior to August 19 we were using mklink /J but with a Windows update we run into problems of extension signing which using the /D flag avoids. There is a small con to using the /D flag in that if the link already exists one needs to delete it to change the link.

Windows User Folder Example You do not need to open CMD with admin rights for this.

mklink /D "C:\Users\USERNAME\AppData\Roaming\Adobe\CEP\extensions\FabExt" "C:\Repositories\Fab\com.creative-scripts.FabExt"

Windows System Folder Example You need to open CMD with admin rights for this.

mklink /D "C:\Program Files\Common Files\Adobe\CEP\extensions\FabExt" "C:\Repositories\Fab\com.creative-scripts.FabExt"

Change the "path to link" and "path to original" as needed

How to easily copy the file paths?

Select the file in Explorer and press shift and right click on the file then select Copy as path.
The path including the surrounding quotes are coppied into the clipboard ready for pasting.
For an easier and nicer method see Copy path – Add to Context Menu in Windows 10

One Comment on “Symbolic Links”

  1. Trevor

    To safely remove a symbolic link in Windows see How can I delete a symbolic link?
    In short one can safely delete the link in explorer using the delete key.
    In CMD one should use the rmdir to just remove the link and not the original. If one uses the del command in CMD it will remove both the link and original folder.
    On Mac one can also safely delete the link from Finder.
    Thanks for Sergey Kritskiy for bringing up the topic and providing the link.

Leave a Reply

Your email address will not be published. Required fields are marked *