문제

Version output is:

GNU CLISP 2.33 (2004-03-17) (built 2004-05-24 16:21:45)
Software: GNU C 3.3.1 (cygming special) ANSI C program
Features: (CLISP ANSI-CL COMMON-LISP LISP=CL INTERPRETER SOCKETS GENERIC-STREAMS
LOGICAL-PATHNAMES SCREEN FFI UNICODE BASE-CHAR=CHARACTER PC386 WIN32)

A search brings up EXT:MAKE-DIRECTORY but that doesn't work on this version.

I know it's a rather old version, but it's what I have at the moment and I'm having other trouble trying to use the latest version.

I'd like something that will create all directories for a full path, but even just being able to create a single one would be useful.

도움이 되었습니까?

해결책

To create directory foo in the current working directory:

(ensure-directories-exist "foo/")

It can also create a whole directory structure for you:

(ensure-directories-exist "/tmp/lisp/rulez/")

Note, the slash at the end is important, it won't work without it.

Another thing is that it's possible that you don't use EXT:MAKE_DIRECTORY correctly. If you just pass to it a string with directory name then it won't work. You need to use it like this:

 (ext:make-directory (make-pathname :directory '(:relative "foobar")))

다른 팁

CLISP 2.44 (2008-02-02) renamed EXT:MAKE-DIR to EXT:MAKE-DIRECTORY.

Use either ENSURE-DIRECTORIES-EXIST or EXT:MAKE-DIR.

It's curious that you don't have EXT:MAKE-DIRETORY. 2004 is "old", but it's not that old in terms of CLISP, and EXT:MAKE-DIRECTORY is pretty basic functionality. Perhaps this CLISP was built specifically without it for some odd reason.

The other solution is to invoke the command line (EXT:SHELL and friends), but if you don't have EXT:MAKE-DIRECTORY, perhaps you won't have those as well. Plus this would be more platform dependent (such that the commands are platform dependent), and just not as well integrated. But it would be possible (assuming they exist as well).

Is there any possibility of upgrading CLISP?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top