Code was not calling the handle-conflict function

This commit is contained in:
GLENN THOMPSON 2024-09-08 13:33:47 +03:00
parent 42394e1378
commit c4ec8e5cbe
1 changed files with 8 additions and 9 deletions

View File

@ -121,18 +121,17 @@
(else
(display (color-message "No valid action selected, no changes made.\n" red-text)))))
(define (create-symlink source target)
"Create a symlink for the source directory at the target location."
(let ((target-symlink-path (string-append target "/" (basename source))))
(if (file-exists? target-symlink-path) ; Checks if the path exists (file, directory, or symlink)
(handle-conflicts target-symlink-path source) ; Handle existing path
(begin
(catch 'system-error
(lambda () (symlink source target-symlink-path)
(display (color-message (string-append "Symlink created for: " target-symlink-path " -> " source "\n") green-text)))
(lambda args
(display (color-message "File exists. Unable to create symlink.\n" red-text))))))))
(if (file-exists? target-symlink-path)
(handle-conflicts target-symlink-path source) ; Call conflict handler if file exists
(catch 'system-error
(lambda ()
(symlink source target-symlink-path)
(display (color-message (string-append "Symlink created for: " target-symlink-path " -> " source "\n") green-text)))
(lambda args
(display (color-message "Error creating symlink.\n" red-text)))))))
(define (main args)
"Main function to parse arguments and initiate processing."