Win32: Delete read-only file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Win32: Delete read-only file

Robert Krahn
Hello!

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?

Thank you!

Robert
_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Win32: Delete read-only file

David T. Lewis
On Thu, Jan 31, 2008 at 02:47:54PM +0100, Robert Krahn wrote:
> Hello!
>
> 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.

Dave

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Win32: Delete read-only file

Nicolas Cellier-3
David T. Lewis a écrit :

> On Thu, Jan 31, 2008 at 02:47:54PM +0100, Robert Krahn wrote:
>> Hello!
>>
>> 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.
>
> Dave

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.


_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners
Reply | Threaded
Open this post in threaded view
|

Re: Re: Win32: Delete read-only file

Robert Krahn
Hello,

thank you for the information.

The usage of OSProcess would be fine. E.g. if I could execute  
OSProcess command: 'del /a:R test' to delete the read-only file named  
test. But unfortunately I get an error when I try to do this.

OSProcess command: 'rm test' on the other hand does work. But I  
cannot delete read-only files with the rm command (at least I don't  
know how).

So if there would be a way to  use the del command with OSProcess I  
would be happy...

Robert


Am Feb 1, 2008 um 9:28 PM schrieb nicolas cellier:

> David T. Lewis a écrit :
>> On Thu, Jan 31, 2008 at 02:47:54PM +0100, Robert Krahn wrote:
>>> Hello!
>>>
>>> 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.
>> Dave
>
> 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.
>
>
> _______________________________________________
> Beginners mailing list
> [hidden email]
> http://lists.squeakfoundation.org/mailman/listinfo/beginners

_______________________________________________
Beginners mailing list
[hidden email]
http://lists.squeakfoundation.org/mailman/listinfo/beginners