1507 |
|
|
1508 |
;;; File Name Handler Functions: |
;;; File Name Handler Functions: |
1509 |
|
|
|
;; The following file name handler ops are not implemented (yet?). |
|
|
|
|
1510 |
(defun tramp-handle-make-symbolic-link |
(defun tramp-handle-make-symbolic-link |
1511 |
(filename linkname &optional ok-if-already-exists) |
(filename linkname &optional ok-if-already-exists) |
1512 |
"Like `make-symbolic-link' for tramp files. |
"Like `make-symbolic-link' for tramp files. |
1513 |
The LINKNAME argument should look like \"/path/to/target\" or |
If LINKNAME is a non-Tramp file, it is used verbatim as the target of |
1514 |
\"relative-name\",and not like a Tramp filename." |
the symlink. If LINKNAME is a Tramp file, only the path component is |
1515 |
(error "Not implemented yet") |
used as the target of the symlink. |
1516 |
|
|
1517 |
|
If LINKNAME is a Tramp file and the path component is relative, then |
1518 |
|
it is expanded first, before the path component is taken. Note that |
1519 |
|
this can give surprising results if the user/host for the source and |
1520 |
|
target of the symlink differ." |
1521 |
(with-parsed-tramp-file-name linkname l |
(with-parsed-tramp-file-name linkname l |
1522 |
(when (tramp-ange-ftp-file-name-p l-multi-method l-method) |
(when (tramp-ange-ftp-file-name-p l-multi-method l-method) |
1523 |
(tramp-invoke-ange-ftp 'make-symbolic-link |
(tramp-invoke-ange-ftp 'make-symbolic-link |
1530 |
"ln(1) does not exist on the remote host."))) |
"ln(1) does not exist on the remote host."))) |
1531 |
|
|
1532 |
;; Do the 'confirm if exists' thing. |
;; Do the 'confirm if exists' thing. |
1533 |
(when (file-exists-p (expand-file-name filename |
(when (file-exists-p linkname) |
|
CCC)) |
|
1534 |
;; What to do? |
;; What to do? |
1535 |
(if (or (null ok-if-already-exists) ; not allowed to exist |
(if (or (null ok-if-already-exists) ; not allowed to exist |
1536 |
(and (numberp ok-if-already-exists) |
(and (numberp ok-if-already-exists) |
1538 |
(format |
(format |
1539 |
"File %s already exists; make it a link anyway? " |
"File %s already exists; make it a link anyway? " |
1540 |
l-path))))) |
l-path))))) |
1541 |
(signal 'file-already-exists (list "File already exists" l-path)))) |
(signal 'file-already-exists (list "File already exists" l-path)) |
1542 |
|
(delete-file linkname))) |
1543 |
|
|
1544 |
|
;; If FILENAME is a Tramp name, use just the path component. |
1545 |
|
(when (tramp-tramp-file-p filename) |
1546 |
|
(setq filename (tramp-file-name-path |
1547 |
|
(tramp-dissect-file-name |
1548 |
|
(expand-file-name filename))))) |
1549 |
|
|
1550 |
;; Right, they are on the same host, regardless of user, method, etc. |
;; Right, they are on the same host, regardless of user, method, etc. |
1551 |
;; We now make the link on the remote machine. This will occur as the user |
;; We now make the link on the remote machine. This will occur as the user |
1555 |
l-multi-method l-method l-user l-host |
l-multi-method l-method l-user l-host |
1556 |
(format "cd %s && %s -sf %s %s" |
(format "cd %s && %s -sf %s %s" |
1557 |
cwd ln |
cwd ln |
1558 |
l-path |
filename |
1559 |
filename) |
l-path) |
1560 |
t))))) |
t))))) |
1561 |
|
|
1562 |
|
|