From c4ec8e5cbe1941264c240451af84729b676ef5d9 Mon Sep 17 00:00:00 2001 From: GLENN THOMPSON Date: Sun, 8 Sep 2024 13:33:47 +0300 Subject: [PATCH] Code was not calling the handle-conflict function --- guile-stash.scm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/guile-stash.scm b/guile-stash.scm index 37a6da0..3c756e2 100644 --- a/guile-stash.scm +++ b/guile-stash.scm @@ -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."