mirror of
https://github.com/Interlisp/maiko.git
synced 2026-01-19 09:18:33 +00:00
Create missing directories when opening directory/file on {UNIX} device for output (#422)
Prior to this change there was no mechanism within Medley to create a new directory
on a {UNIX} style device. This change makes the {UNIX} directory creation happen in
the same manner that {DSK} directory creation is done. Opening a file with access
OUTPUT, BOTH, or APPEND, which would create the file if it does not exist, will also
create any missing directories in the path.
This commit is contained in:
parent
2bf7047709
commit
a18f09d788
24
src/dsk.c
24
src/dsk.c
@ -327,29 +327,23 @@ LispPTR COM_openfile(register LispPTR *args)
|
||||
|
||||
case ACCESS_OUTPUT:
|
||||
flags = O_RDWR | O_TRUNC | O_CREAT;
|
||||
if (dskp) {
|
||||
unpack_filename(file, dir, name, ver, 1);
|
||||
if (make_directory(dir) == 0) return (NIL);
|
||||
link_check_flg = 1;
|
||||
}
|
||||
unpack_filename(file, dir, name, ver, 1);
|
||||
if (make_directory(dir) == 0) return (NIL);
|
||||
if (dskp) link_check_flg = 1;
|
||||
break;
|
||||
|
||||
case ACCESS_BOTH:
|
||||
flags = O_RDWR | O_CREAT;
|
||||
if (dskp) {
|
||||
unpack_filename(file, dir, name, ver, 1);
|
||||
if (make_directory(dir) == 0) return (NIL);
|
||||
link_check_flg = 1;
|
||||
}
|
||||
unpack_filename(file, dir, name, ver, 1);
|
||||
if (make_directory(dir) == 0) return (NIL);
|
||||
if (dskp) link_check_flg = 1;
|
||||
break;
|
||||
|
||||
case ACCESS_APPEND:
|
||||
flags = O_RDWR | O_CREAT;
|
||||
if (dskp) {
|
||||
unpack_filename(file, dir, name, ver, 1);
|
||||
if (make_directory(dir) == 0) return (NIL);
|
||||
link_check_flg = 1;
|
||||
}
|
||||
unpack_filename(file, dir, name, ver, 1);
|
||||
if (make_directory(dir) == 0) return (NIL);
|
||||
if (dskp) link_check_flg = 1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user