I'm coding with allegro 6.2 and I'm trying to write a file with the
following code:
(with-open-file (s myfile
:direction :output
:if-exists :overwrite
:if-does-not-exist :create)
(format s page))
The problem is that the open function creates the file only if the
directory where to put it already exists. If the directory doesn't exits
I have the following error:
creating #p"output\\cgi-bin\\wiki_pl.html" (which translates to
"C:\apps\eclipse\workspace\WebRec\output\cgi-bin\wiki_pl.html") resulted
in error (code 2): No such file or directory.
Isn't there a way to automatically create the file and all the
directories to save it (I thought that :if-does-not-exist :create was
enogh)? If no how do you resolve this problem?
Thanks.
Giannandrea
From: Howard Ding <······@hading.dnsalias.com>
Subject: Re: newbie question: create directories with open
Date:
Message-ID: <m33cgedisv.fsf@frisell.localdomain>
You want to look into the function ensure-directories-exist.
--
Howard Ding
<······@hading.dnsalias.com>
Giannandrea Castaldi <········@tiscali.it> writes:
[...]
> Isn't there a way to automatically create the file and all the
> directories to save it (I thought that :if-does-not-exist :create was
> enogh)? If no how do you resolve this problem?
Look up ensure-directories-exist in the HyperSpec.
Andras
>
> Thanks.
>
> Giannandrea