[ANN] win32-file 0.1.0

From: Gavin Sinclair [mailto:gsinclair@soyabean.com.au]
Sent: Wednesday, October 29, 2003 11:21 PM
To: ruby-talk@ruby-lang.org
Subject: Re: [ANN] win32-file 0.1.0

Hi all,

I am happy to announce the release of win32-file
0.1.0. This package provides additional methods for
the File class specific to the Win32 platform, mostly
related to file/directory attribute information.

Good work.

Thanks :slight_smile:

Synopsis

require “win32/file”

some_file = “C:\Documents and
Settings\some_user\fruitylicious.txt”

Win32::File.attributes(some_file) # e.g. [‘hidden’,‘archive’]

Why not use symbols instead?

Dunno - didn’t think it really mattered. Does it?

Win32::File.short_path(some_file) # “fruity~1.txt”

shudder :slight_smile:

:stuck_out_tongue:

Regards,

Dan

¡¡¡

-----Original Message-----

Berger, Daniel wrote:
…

> > Synopsis

> > ========

> > require “win32/file”

> >

> > some_file = "C:\Documents and

> Settings\some_user\fruitylicious.txt"

> >

> > Win32::File.attributes(some_file) # e.g.

[‘hidden’,‘archive’] # > # > Why not use symbols instead?

Dunno - didn’t think it really mattered. Does it?

Personally, I generally dislike the symbol-as-hash key
style–even if there is some kind of performance gain to be
had from it. So, you’ve got my vote to keep it as it is. :slight_smile:

Just throwing in a curve ball on this frivolous matter, but
I strongly prefer the symbol style over strings. In fact, it
always bucket me that the reflection methods like
Module#instance_methods or Object#instance_variables
return arrays of strings instead of symbols.

Ps. Thank you very much for all win32 extension -
they are really fantastic! Also what kind of nfts (5+)
features will your win32/file extension support?

/Christoph

Just throwing in a curve ball on this frivolous matter, but

I strongly prefer the symbol style over strings. In fact, it

always bucket me that the reflection methods like

Module#instance_methods or Object#instance_variables

return arrays of strings instead of symbols.

¡¡¡

On Fri, 31 Oct 2003, Christoph wrote:

That (instance_methods and instance_variables), I can agree with. To me,
it’s all in how I’m going to use something. It’s rare that I want a hash
key to be a symbol, but it’s fairly often that I’d like it to be a string.

Ultimately it doesn’t really matter too much, though. So, Dan, don’t
change it in this case. :slight_smile:

Chad

Actually, shouldn’t these be constants of the File class?

Something like this maybe:

Win32::File.attributes(some_file) → {File::HIDDEN => true, File::ARCHIVE =>
true}

Sean O'Dell
¡¡¡

On Thursday 30 October 2003 09:59 am, Christoph wrote:

Berger, Daniel wrote:
…

> > Synopsis

> > ========

> > require “win32/file”

> >

> > some_file = "C:\Documents and

> Settings\some_user\fruitylicious.txt"

> >

> > Win32::File.attributes(some_file) # e.g.

[‘hidden’,‘archive’] # > # > Why not use symbols instead?

Dunno - didn’t think it really mattered. Does it?

Personally, I generally dislike the symbol-as-hash key
style–even if there is some kind of performance gain to be
had from it. So, you’ve got my vote to keep it as it is. :slight_smile:

Just throwing in a curve ball on this frivolous matter, but
I strongly prefer the symbol style over strings. In fact, it
always bucket me that the reflection methods like
Module#instance_methods or Object#instance_variables
return arrays of strings instead of symbols.

Ps. Thank you very much for all win32 extension -
they are really fantastic! Also what kind of nfts (5+)
features will your win32/file extension support?

Sean O’Dell wrote:

Berger, Daniel wrote:
…

> > Synopsis

> > ========

> > require “win32/file”

> >

> > some_file = "C:\Documents and

> Settings\some_user\fruitylicious.txt"

> >

> > Win32::File.attributes(some_file) # e.g.

[‘hidden’,‘archive’] # > # > Why not use symbols instead?

Dunno - didn’t think it really mattered. Does it?

Personally, I generally dislike the symbol-as-hash key
style–even if there is some kind of performance gain to be
had from it. So, you’ve got my vote to keep it as it is. :slight_smile:

Just throwing in a curve ball on this frivolous matter, but
I strongly prefer the symbol style over strings. In fact, it
always bucket me that the reflection methods like
Module#instance_methods or Object#instance_variables
return arrays of strings instead of symbols.

Ps. Thank you very much for all win32 extension -
they are really fantastic! Also what kind of nfts (5+)
features will your win32/file extension support?

Actually, shouldn’t these be constants of the File class?

Something like this maybe:

Win32::File.attributes(some_file) → {File::HIDDEN => true, File::ARCHIVE =>
true}

    Sean O'Dell

For this particular method I don’t think it’s necessary. It’s certainly
less painful to return and/or parse an array of strings vs. a hash of
hashes that contains constants. However, I may add it in the future for
‘set’ methods. Perhaps something like:

File.chattr(file,AttributeConstant) - Set file win32 attribute

File.chattr(“some_file”,File::HIDDEN)

I’ll think about it. I should also mention that I wouldn’t expect this
to be a highly used method, so maybe that’s why I’m somewhat indifferent
on the subject. In any case, adding the security stuff has higher
priority at the moment (to answer Christoph’s earlier question). Thanks
for the feedback!

Regards,

Dan

¡¡¡

On Thursday 30 October 2003 09:59 am, Christoph wrote: