doom-directory-size: error if path doesn't exist

This commit is contained in:
Henrik Lissner 2019-11-10 04:29:53 -05:00
parent e252ee61e7
commit dd1dd6901f
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -181,6 +181,8 @@ single file or nested compound statement of `and' and `or' statements."
;;;###autoload
(defun doom-directory-size (dir)
"Returns the size of FILE (in DIR) in kilobytes."
(unless (file-directory-p dir)
(error "Directory %S does not exist" dir))
(if (executable-find "du")
(/ (string-to-number (cdr (doom-call-process "du" "-sb" dir)))
1024.0)