From 871fc3ed55333dfefe77588b129d7e5fefe9a0f0 Mon Sep 17 00:00:00 2001 From: KKlochko Date: Mon, 2 Oct 2023 22:26:32 +0300 Subject: [PATCH] Fix checking for file existence only when the options are set. --- src/cipher_analytical_machine/cli.clj | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cipher_analytical_machine/cli.clj b/src/cipher_analytical_machine/cli.clj index 86c05eb..1ea0653 100644 --- a/src/cipher_analytical_machine/cli.clj +++ b/src/cipher_analytical_machine/cli.clj @@ -69,10 +69,12 @@ (map-has-keys? options [:message, :message-file]) {:exit-message (error-msg ["You can't use message and message-file options at the same time!!!"])} - (file/is-file-not-exists? (:message-file options)) + (and (contains? options :message-file) + (file/is-file-not-exists? (:message-file options))) {:exit-message (error-msg ["Please, check the path to the message file!!!"])} - (file/is-file-exists? (:output-file options)) + (and (contains? options :output-file) + (file/is-file-exists? (:output-file options))) {:exit-message (error-msg ["Please, choose another file!!! Overwriting was prevented!!!"])} (and (map-has-keys? options [:cipher, :key])