def resolve_shortcut(path): if os.name == 'nt': sc = Shortcut() sc.load(path) return sc.GetPath(0)[0] else: # boy, I don't know return path
def create_shortcut(source, dest, *args): if os.name == 'nt': if len(args) == 0: args = None path, file = os.path.split(source) sc = Shortcut(source, arguments=args, workingdir=path) sc.save(dest) else: # some other os may not support this, but throwing an error is good since # the function couldn't do what was requested os.symlink(source, dest) # linux also can't do args... maybe we should spit out a shell script? assert not args