Re: make-pathname

Kevin Layer <[email protected]>
Newsgroups gmane.lisp.allegro
Message-ID <[email protected]>
Why not just this?

(defun make-index ()
  (with-open-file (str "d:/webpage/index.html"
		   :direction :output :if-exists :supersede
		   :if-does-not-exist :create)
    (html-stream str (:html
		      (:head (:title "Test"))
		      (:body (:h1 "Test")
			     "HTML generator test.")))))

You can also specify it as "d:\\webpage\\index.html".

Jorge Tavares <[email protected]> wrote:

>> This is a simple question but until now I was unable to find an
>> answer. Supose i want to make a function that writes into a file in a
>> specified directory.
>> 
>> For example:
>> 
>> (defun make-index ()
>>    (with-open-file (str (make-pathname
>>                          :name "index.html" :directory '(:absolute
>> "webpage"))
>>                         :direction :output :if-exists :supersede
>>                         :if-does-not-exist :create)
>>      (html-stream str (:html
>>                        (:head (:title "Test"))
>>                        (:body (:h1 "Test")
>>                               "HTML generator test.")))))
>> 
>> In this function, I can do what I want but with the exception of one
>> minor detail: it saves the "index.html" in "C:\webpage". If I want the
>> drive changed, for example "D:\webpage", what is the :absolute
>> replacement? I've tried just puttng the string "D:\\webpage" but it
>> always translate into "C:\<ACL DIR>\D:\webpage".
>> 
>> What are the options for make-pathname? I've search the documentation
>> but I was unable to find something this simple.
>> 
>> 
>> Thanks in advance for any kind of advice,
>> Jorge Tavares
>> 
>> -- 
>> Jorge Tavares
>> http://www.dei.uc.pt/~jast
>> 
>> "Evolution is the best engineer."
>> 
>> 
>> 
>>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.