From 17b874dedd5cb5657478e725ab183bcff1acc1a6 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sun, 10 Nov 2019 01:32:58 -0500 Subject: [PATCH] Refactor doom-file-size Change it throw an error if the file doesn't exist. --- core/autoload/files.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/autoload/files.el b/core/autoload/files.el index 7365641f6..3499f14ad 100644 --- a/core/autoload/files.el +++ b/core/autoload/files.el @@ -169,8 +169,10 @@ single file or nested compound statement of `and' and `or' statements." ;;;###autoload (defun doom-file-size (file &optional dir) - "Returns the size of FILE (in DIR) in kilobytes." - (when-let (file (file-exists-p! file dir)) + "Returns the size of FILE (in DIR) in bytes." + (let ((file (expand-file-name file dir))) + (unless (file-exists-p file) + (error "Couldn't find file %S" file)) (unless (file-readable-p file) (error "File %S is unreadable; can't acquire its filesize" file))