[LUAU] Windows shortcut equivalent in Linux

Vince Hoang luau at ml.altern8.net
Tue May 18 20:34:11 PDT 2004


On Tue, May 18, 2004 at 02:32:55PM -1000, Vikram Khurana wrote:
> The reason I can't do cd ~ is because it may or may not be in the home
> directory.
> Here is why. The way I intend to distribute this program is by zipping up
> the directory tree which looks like
> 
> /Parse/Linux/<Linux executable>
> /Parse/Windows/<Windows executable>
> /Parse/123.dat
> 
> Now the user could save this anywhere they want. Now in Win I can tell
> people to create a shortcut to /<some directory>/Parse/Windows/<Windows
> executable> & place it in any folder they want. The 123.dat file is read
> relative to the executables.
> 
> How do I do the same in Linux?

You mean "How do I do this in perl?"

Use readlink().

Create the symlink in your user's path. In your perl code, add
logic to read the symlink with readlink() and then strip off
everything accept the base path. As a bonus, grab your present
working directory with $ENV{PWD}. Now you have variables that
tell you about both directory trees that you need access to, and
can use chdir() at will.

-Vince



More information about the LUAU mailing list