[Vm-dev] Squeak FileAttributes (was: FilePlugin>>primitiveFileStdioHandles fails incorrectly?)

Alistair Grant akgrant0710 at gmail.com
Thu Aug 9 14:15:40 UTC 2018


Hi Eliot,

On Thu, 9 Aug 2018 at 10:37, Alistair Grant <akgrant0710 at gmail.com> wrote:
> >
> > BTW, is there any image level source code available for accessing the FileAttributesPlugin's primitives?  This is lazy of me, but if there is could you email me a pointer to the code or the code itself asap?  TIA
> >
> > P.S> I'm specifically looking for code to implement testing directory writability in Squeak.
>
> OK, just a warning in advance: The code (VM and image) works fine on
> Linux and Windows.  I didn't know about the Mac file encoding quirks
> until recently, so need to change the plugin to work properly on Mac
> OS.  But I haven't got the VM to compile on my Mac virtualbox machine,
> so the changes are still local to my PC.  This won't affect you unless
> you've got non-ascii characters in your file names.  I should have
> fixed this by now, but the problems compiling on Mac have frustrated
> me, and I've had very little time (personal reasons).
>
> The main repository for the image side file attributes code is at:
> https://github.com/akgrant43/pharo/tree/21368-Integrate-FileAttributesPlugin.
>
> If you're not comfortable with git I think figuring out the changes
> will be difficult.  I've got a .cs from a slightly earlier revision
> which I can email you - probably directly, it's 93Kb.
>
> I'll try and put together a change set which just includes enough code
> to get file attributes.
>
> Any other questions, of course please let me know.

I'll reply to this with a change set that should get you started.

Disclaimer: I've thrown this together in about half an hour and
checked that I can get directory permissions.  Anything (and probably
everything :-)) else could fail.

The squeak VM I have doesn't include the FileAttributesPlugin.  To get
going I simply copied FileAttributesPlugin.so from my Pharo VM (this
is on Ubuntu 16.04 (I know, bad practice, but no time to build a new
VM right now)).

Once you've filed in the change set you should be able to:

1.  FileAttributesPrimitives fileAttributesVersionString    "'1.3.2'"

2. (DiskDirectoryEntry reference: '/bin') isWritable   "false"

3. (DiskDirectoryEntry reference: '/home/myhomedir') isWritable   "true"

DiskDirectoryEntry normally expects to hold a FileReference in Pharo.
I've hacked it enough to accept a string instead.

Sorry for the lack of testing, but wanted to try and get at least
something to you.  I hope to have some more time tonight to tidy this
up if you want, or answer any other questions.

Cheers,
Alistair


More information about the Vm-dev mailing list