Symlink droplet

Although this can be easily adapted to work without MacPython’s
EasyDialogs, it would not make sense.
This is meant to be an applet used to easily create unix symlinks from
the Finder.

import os
import sys

import EasyDialogs
from EasyDialogs import Message

exec_path = sys.argv[0]
if len(sys.argv) < 2:
    Message('Drag a file onto SymlinkDroplet')
    i = exec_path.find("SymlinkDroplet")
    dir_path = exec_path[:i]
    for file_ in sys.argv[1:]:
       if os.path.isfile(file_):
           linkname = os.path.basename(file_)
           os.symlink(file_, os.path.join(dir_path, linkname))


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: