Hi all,
I'd like to push a really core change in file management: the working directory. This is really needed for command line apps, when you have your app deployed in some directory and you're launching it from another one. The current implementation, where workingDirectory = imageDirectory, forces to have absolute paths or extra handling all over the place to manage this complexity.
Rajula proposed a couple of months ago a solution for this based on the getcwd functions. You can read in his blogpost why using getcwd is better than $PWD in general here:
Now, since accessing the working directory is a core part of Pharo but based on UFFI, his implementation was breaking the build process. We cannot and we will not integrate UFFI in the bootstrap because it depends mainly on the compiler which is a big beast. Instead, I propose that only for this core-core-core feature, we use directly FFI.
In other words, the bootstrap will include just a couple of classes to manage the basics of FFI. And the working directory will be fetched by using this low level API. Such a call looks like this:
(ExternalLibraryFunction
name: 'getcwd'
module: 'libc.dylib'
callType: 1
returnType: ExternalType char asPointerType
argumentTypes: {
ExternalType char asPointerType.
ExternalType long })
invokeWith: buffer with: bufferSize.
We reviewed it with Pablo two days ago. The build process works with this implementation and tests are still running. The pull request is in here:
Thanks,
Guille, Pablo and Rajula
--
|
| Guille Polito Research Engineer
Centre de Recherche en Informatique, Signal et Automatique de Lille CRIStAL - UMR 9189
Phone: +33 06 52 70 66 13
|