Path: csiph.com!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Patricia Ferreira Newsgroups: pt.comp.programacao Subject: Re: sobre common lisp e o sistema de arquivos Date: Thu, 25 Jan 2024 01:01:33 -0300 Organization: A noiseless patient Spider Lines: 51 Message-ID: <87wmryf4de.fsf@example.com> References: <87v87la7zs.fsf@example.com> <878r4h9o4m.fsf@example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: dont-email.me; posting-host="e128fb2022b89319302912dd7d020a5d"; logging-data="2298686"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/yFylR75UP4BA+18a6IeAoN5IHZHTxiDU=" Cancel-Lock: sha1:54EX6o9zUCJ4eHoibfzszbh9INg= sha1:RPT+KGXZz1PZdmqsowldmlZHQ7Q= Xref: csiph.com pt.comp.programacao:193 Patricia Ferreira writes: > Patricia Ferreira writes: > >> Tenho lido vários pedaços de documentação Common Lisp por aí, livros >> incluindo. Antes de falar com o sistema de arquivos, vale a pena ler o >> capítulo 14 de Peter Seibel ``Practical Common Lisp''. >> >> Files and File I/O >> https://gigamonkeys.com/book/files-and-file-io.html >> >> ``When pathnames were designed, the set of file systems in general use >> was quite a bit more variegated than those in common use today. >> Consequently, some nooks and crannies of the pathname abstraction make >> little sense if all you're concerned about is representing Unix or >> Windows filenames.'' > > Eis o tipo de armadilha contras as quais estamos. Eis outra. NNTPD> (sb-posix:getcwd) "c:\\sys\\emacs\\usr\\quicklisp\\local-projects\\nntp\\groups\\local.test" NNTPD> (uiop:getcwd) #P"c:/sys/emacs/usr/quicklisp/local-projects/nntp/groups/local.test/" Está bem claro em que diretório SBCL está. Agora, observe: %pwd c:/sys/emacs/usr/quicklisp/local-projects/nntp/groups/local.test %ls 2 3 4 Se eu pedir pra abrir 2, 3 ou 4, conseguirei com certeza: NNTPD> (open "2") The file #P"c:/sys/emacs/usr/quicklisp/local-projects/nntp/2" does not exist: The system cannot find the file specified. Lol---open olha outro diretório. A conclusão parece simples. Procedimentos e macros como open, with-open-file et cetera usam a variável *default-pathname-defaults* e ignoram o current-working-directory do processo. A variável relevant é NNTPD> *default-pathname-defaults* #P"c:/sys/emacs/usr/quicklisp/local-projects/nntp/" É preciso conhecer essa vida pré-UNIX.