Jim Newton
2/1/2016 9:47:00 AM
What would someone suspect that (OPEN path :direction :output :if-exists :append)
in the case that the file does not already exist? Apparently, it signals an error. However, if I
include :if-does-not-exist :create, it works fine.
This seems strange. It would seem to me that if the file does not exist then :if-exists should be ignored.
Right? So that if the file does not exist, (OPEN path :direction :output)
and (OPEN path :direction :output :if-exists :append) should be equivalent???
Here is what I get:
(OPEN #P"/tmp/1.data" :direction :output :if-exists :append)
error opening #P"/tmp/1.data": No such file or directory
[Condition of type SB-INT:SIMPLE-FILE-ERROR]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [*ABORT] Return to SLIME's top level.
2: [ABORT] abort thread (#<THREAD "repl-thread" RUNNING {1012F80003}>)
Backtrace:
0: (SB-IMPL::SIMPLE-FILE-PERROR "error opening ~S" #P"/tmp/1.data" 2)
1: ((FLET SB-IMPL::VANILLA-OPEN-ERROR :IN OPEN))
2: (OPEN #P"/tmp/1.data" :DIRECTION :OUTPUT :ELEMENT-TYPE BASE-CHAR :IF-EXISTS :APPEND :IF-DOES-NOT-EXIST NIL :EXTERNAL-FORMAT :DEFAULT :CLASS SB-SYS:FD-STREAM)