1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 load("operatingsystem.lisp");
5 /* maxima-getenv() is an existing lisp-function. Just assign a consistent name
6 for a maxima function for it (callable without a leading '?' and the need to
7 quote the "-" by "\-". */
9 getenv(s) := ?maxima\-getenv(s) $
12 setenv(s, t) := ?getenv(s, t) $
14 putenv(s, t) := setenv(s, t) $
16 getcurrentdirectory() := ?os\-getcurrentdirectory() $
18 delete_file(s) := ?delete\-file(s)$
20 chdir(s) := ?os\-chdir(os_endwithslash(s)) $
22 mkdir(s) := ?os\-mkdir(os_endwithslash(s)) $
24 rmdir(s) := ?os\-rmdir(os_endwithslash(s)) $
26 /* currently works only with files; TODO: allow directories too.
27 (CLISP: (ext:rename-directory "testdir1/" "testdir2/") (with trailing slashes) */
28 rename_file(f, t) := ?rename\-file(f, t)$
30 copy_file(f, t) := ?os\-copy\-file(f, t)$
32 /* ensure that the directoryname ends with an slash */
33 os_endwithslash(s) := if charat(s, slength(s)) = "/" then s else concat (s, "/")$