Refactor doom-file-size
Change it throw an error if the file doesn't exist.
This commit is contained in:
parent
d3d51e32a2
commit
17b874dedd
1 changed files with 4 additions and 2 deletions
|
@ -169,8 +169,10 @@ single file or nested compound statement of `and' and `or' statements."
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(defun doom-file-size (file &optional dir)
|
(defun doom-file-size (file &optional dir)
|
||||||
"Returns the size of FILE (in DIR) in kilobytes."
|
"Returns the size of FILE (in DIR) in bytes."
|
||||||
(when-let (file (file-exists-p! file dir))
|
(let ((file (expand-file-name file dir)))
|
||||||
|
(unless (file-exists-p file)
|
||||||
|
(error "Couldn't find file %S" file))
|
||||||
(unless (file-readable-p file)
|
(unless (file-readable-p file)
|
||||||
(error "File %S is unreadable; can't acquire its filesize"
|
(error "File %S is unreadable; can't acquire its filesize"
|
||||||
file))
|
file))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue