4

I created a soft link with following command:

ln -s "/media/Eric/node/language/1-1.English/space@English/7-2 IELTS" ~/desktop/IELTS

On my desktop, when click to open the IELTS dir, the path is /home/eric/Desktop/IELTS.

I want the path to be the original path /media/Eric/node/language/1-1.English/space@English/7-2 IELTS, is that possible?

muru
  • 72,889
Eric
  • 401
  • See if this is relevant - http://unix.stackexchange.com/questions/84175/create-a-symbolic-link-relative-to-the-current-directory – cutrightjm Sep 18 '16 at 09:18
  • @cutrightjm Thanks for help, but it's not relevant much. In the question I did get the soft link works well, but the displaying directory path is the path of soft link, but not the path of original directory, if there is an option to display the original directory instead of the path of soft link then it would be convenient for some case. – Eric Sep 18 '16 at 10:02

2 Answers2

3

short: no, you cannot do it this way

long: a desktop launcher may work for you.

Unix-style symbolic links have only a target directory; there is no separate property for source directory. You can read about symbolic links in

As the question points out, the source directory is the desktop directory.

A comment mentions Create a symbolic link relative to the current directory, but that is not relevant to the question.

The question refers to the behavior of shortcuts in Microsoft Windows. With a desktop launcher, you can imitate this behavior (referring to Desktop Entry Specification, in the section Recognized desktop entry keys):

Exec
Program to execute, possibly with arguments. See the Exec key for details on how this key works. The Exec key is required if DBusActivatable is not set to true. Even if DBusActivatable is true, Exec should be specified for compatibility with implementations that do not understand DBusActivatable.

Path
If entry is of type Application, the working directory to run the program in.

Unix symbolic links are constants, while Windows shortcuts can have (like Apollo Domain during the 1980s) embedded variables. While the desktop specification goes into some detail regarding what is legal in Exec (special variables), it lacks detail on where your environment variables might be used. So implementations will differ.

Fortunately, the question as posed only requires constants, and launchers are the place to look for solutions.

Thomas Dickey
  • 76,765
1

A symbolic link will not do this. However, a link-type desktop file will.

To try this for yourself, create a desktop file called e.g. link-to-7-2-IELTS.desktop with these contents:

[Desktop Entry]
Name=Link to 7-2 IELTS
Type=Link
URL=file:///media/Eric/node/language/1-1.English/space%40English/7-2%20IELTS
Icon=folder

Note that the @ sign and spaces in the path need to be percent-encoded to convert it into a proper file:// URL. Some file managers will assist you in generating these files.

Related: