[Newbies] Re: Win32: Delete read-only file
ncellier at ifrance.com
Fri Feb 1 20:28:31 UTC 2008
David T. Lewis a écrit :
> On Thu, Jan 31, 2008 at 02:47:54PM +0100, Robert Krahn wrote:
>> How can I delete a read-only file under windows.
>> FileDirectory>>deleteFileNamed: gives me a CannotDeleteFileException.
>> Can I force the deletion? Can I change the file properties?
> Hi Robert,
> Squeak tries to be very portable across operating systems, so in
> general it does not provide much in the way of operating system
> or file system functions. Changing file properties is not supported
> in Squeak, mainly because the concept of "file properties" means
> different things on different file systems and operating systems.
> There are some add-on packages that can help with this sort of
> thing (such as FFI and OSProcess), but you can't count on these
> being available on all Squeak images or on all operating systems.
> It's probably a good idea for you to handle things like this
> with a Windows file browser unless there is a strong reason to
> do it from Squeak.
Squeak file handling library is not that sexy. I feel like portability
is not the only reason.
For example, VW found a common denominator (linux/windows/mac/...) :
'foo.bar' asFilename makeWritable.
'foo.bar' asFilename directory makeWritable.
Sure, not perfect, you don't really know to who exactly will this
writable flag apply, nor if the request will ever succeed...
But at least, it has a chance to solve some simple situations.
More information about the Beginners