def edit_link(tab): fullfilename = os.path.join(tab.path, tab.sorted[tab.file_i]) if not os.path.islink(fullfilename): return pointto = wcall.entry_editlink(tab.path, tab.sorted[tab.file_i], os.readlink(fullfilename)) if pointto in [None, '']: return elif pointto != os.readlink(fullfilename): ans = modify_link(pointto, fullfilename) if ans: wcall.err_editlink('%s (%s)' % (ans, tab.sorted[tab.file_i])) tab.pane.app.regenerate()
def create_link(tab): othertab = tab.pane.app.noact_pane.act_tab pointto = os.path.join(tab.path, tab.sorted[tab.file_i]) newlink = os.path.join(othertab.path, tab.sorted[tab.file_i]) newlink, pointto = wcall.dentry_createlink(pointto, newlink) if newlink == None or pointto == None: return if newlink == '': wcall.err_emptylink() return if pointto == '': wcall.err_emptyfilename() return try: os.symlink(pointto, newlink) except OSError, e: wcall.err_editlink('%s (%s)' % (e, tab.sorted[tab.file_i]))