Closed mkrauss closed 4 years ago
I was able to patch this with the following defun:
(defun mkdir (dir &optional parents)
"Revised mkdir to test quick patch for FTP publishing - should
be functionally equivilant to calling standard mkdir or
make-directory, but work over FTP when the directory already
exists and PARENTS is true."
(unless (and parents (file-accessible-directory-p dir))
(make-directory dir parents)))
Yes, I know this is a cheap hack and not a proper solution...
Please try that patch:
@@ -490,8 +490,10 @@ A copy function COPYF and its arguments ARGS could be specified."
;; file path is nil when exporting static page?
;;(or filepath ".")
(file-name-sans-extension htmlfile)
- (file-name-nondirectory f)))))
- (mkdir (file-name-directory target) t)
+ (file-name-nondirectory f))))
+ (dir (file-name-directory target)))
+ (unless (file-accessible-directory-p dir)
+ (mkdir dir t))
(ob-do-copy f target))))))))
(add-hook 'o-blog-html-plugins-hook 'o-blog-publish-linked-files)
@@ -822,7 +824,9 @@ when publishing a page."
(defun ob-write-file (file)
"Write current buffer to FILE and create full path if necessary."
- (mkdir (file-name-directory file) t)
+ (let ((dir (file-name-directory file)))
+ (unless (file-accessible-directory-p dir)
+ (mkdir dir t)))
(let ((coding-system-for-write
(with-current-buffer
(ob:blog-buffer BLOG)
and let me know
Hmm... Not sure how to apply this? I tried pasting this in to a file (patch.patch) and running "patch o-blog.el patch.patch" and it said it was malformed at line 14. A few other variations after consulting the man page also failed. I may be being stupid - haven't used patch in ages.
So anyhow, I applied it manually, copying and pasting the lines in to o-blog.el and deleting the other lines.
Result: no change, still doesn't work, same error.
Yes a manual patching might be necessary. BTW did you reload the o-blog.el file?
Yes, reloaded Emacs entirely
Ok The problem about modifying a standard function is that o-blog won't be portable anymore.
If you still need to create your own mkdir
function then please leave it in your configuration files.
Sure, of course.
I think this is really a bug with tramp (or perhaps ange-ftp?) I'll try and report it there.
In the mean time, if you do want to add a workaround to O-Blog you could use my defun but just call it "safe-mkdir" and change the two places mkdir is called...
Hi,
I love o-blog - thanks for your hard work! Being able to blog from org-mode may get me to actually start blogging consistently.
So I am having trouble with publishing via FTP, which is the only option on my current web host. I can publish via SSH/SFTP fine to hosts where I have an SSH account, but my web host only lets me use FTP (I know, right?)
I can browse the files on the server, create new files and edit files using Emacs with Tramp just fine.
When I try to publish from o-blog using this:
I get this error:
If I delete that directory from the server, it gets further, but then later gives the same message. I suspect that what is going on here is that o-blog is trying to create the directory with some option that creates it only if it doesn't exist, like "mkdir -p" would, and that tramps with ftp doesn't support that option.
Any advice appreciated, Matthew