summaryrefslogtreecommitdiff
path: root/f.el
diff options
context:
space:
mode:
authorJohan Andersson <johan.rejeep@gmail.com>2016-09-09 17:29:32 +0200
committerJohan Andersson <johan.rejeep@gmail.com>2016-09-30 21:15:25 +0200
commit436b6afec9ceef393d7d67058f19a83040c52226 (patch)
treebacf6c59438b4e65b5f5e40a004bb37c6f050bad /f.el
parent4f8d3112f03e99506bab3c910fa3a29f0b8eb86b (diff)
parent30aa11453c1cda6b10e85b998ac4bf8324d2f794 (diff)
Merge pull request #68 from shlevy/traverse-no-require-exist
f-traverse-upwards: Don't require path to exist.
Diffstat (limited to 'f.el')
-rw-r--r--f.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/f.el b/f.el
index 5b9656a..012e614 100644
--- a/f.el
+++ b/f.el
@@ -288,6 +288,15 @@ If FORCE is t, a directory will be deleted recursively."
(copy-directory from new-to)))
(copy-directory from to))))))
+(defun f-copy-contents (from to)
+ "Copy contents in directory FROM, to directory TO."
+ (unless (f-exists? to)
+ (error "Cannot copy contents to non existing directory %s" to))
+ (unless (f-dir? from)
+ (error "Cannot copy contents as %s is a file" from))
+ (--each (f-entries from)
+ (f-copy it to)))
+
(defun f-touch (path)
"Update PATH last modification date or create if it does not exist."
(f--destructive path
@@ -566,8 +575,6 @@ returned."
(setq path default-directory))
(when (f-relative? path)
(setq path (f-expand path)))
- (unless (f-exists? path)
- (error "File %s does not exist" path))
(if (funcall fn path)
path
(unless (f-root? path)