Directory handling
Mark Evenson
evenson at panix.com
Tue Jun 11 09:33:51 UTC 2019
> On Jun 5, 2019, at 17:53, Marco Antoniotti <marco.antoniotti at unimib.it> wrote:
>
> Dear all,
>
> I have been looking at the ABCL manual and packages and I was not able (my fault!) to find functions like CURRENT-DIRECTORY and/or CHANGE-DIRECTORY (or CHDIR).
>
> Could you tell me how to get to this functionality?
Unfortunately, the JVM doesn’t have a [standard interface to change the working directory][1] there is no direct method to setting the current working directory. The JVM gets a copy of the system environment variables including the current working directory
[1]: https://stackoverflow.com/questions/840190/changing-the-current-working-directory-in-java
It would help to know more specifically what you wish to do after changing the directory, but here’s a guess at what you may wish to do:
If you wish invoke purely Lisp-side functionality, then use the value of CL:*DEFAULT-PATHNAMES-DEFAULTS*, which is what UIOP/OS:GETCWD returns.
If you wish to fork processes in another directory then the specify the relavant argument to UIOP/RUN-PROGRAM:RUN-PROGRAM.
In very pathlogical cases you may have to write a script that ensures the JVM hosting ABCL is started in the directory you wish to have as the current directory. I had to do this in order to get a Minecraft server to run under ABCL.
> Also, what is the set of features that ABCL uses to identify the platform? On a Mac OSX I see (at a minimum):
>
> :SWANK
> :X86-64
> :UNIX
> :DARWIN
> :ARMEDBEAR
> :ABCL
> :COMMON-LISP
> :ANSI-CL
> :CDR6
> :MOP
> :PACKAGE-LOCAL-NICKNAMES
> NIL
>
The code which sets platform features is the [best source of what keywords identify which plaform features][2]. Additionaly, there is (incomplete) support for identifying the JVM version by the use of the :java-1.6, :java-1.7, and :java—1.8 keywords. Again, it would be helpful to know what sort of platform features you wish to detect.
[2]: https://abcl.org/trac/browser/trunk/abcl/src/org/armedbear/lisp/Lisp.java#L2362
--
"A screaming comes across the sky. It has happened before but there is nothing
to compare to it now."
More information about the armedbear-devel
mailing list