Using your method (A string asFileReference) it works thanks ! But if you use FileSystem root / .... I get the "same" object but it's still not working. Did I make a mistake somewhere? 2016-04-18 10:38 GMT+02:00 Sven Van Caekenberghe <sven@stfx.eu>:
Hi Valentin,
On 18 Apr 2016, at 10:31, Valentin Ryckewaert < valentin.ryckewaert@gmail.com> wrote:
Hi everyone,
I'm trying to rename files with this code but it doesn't work, pharo is saying me "PrimitiveFailed" I tried lots of things and I'm not finding how I can rename this file, someone has an idea please?
| myFile | myFile := FileSystem root / 'aPath/cat.jpg'. myFile renameTo:'cats.jpg'
Valentin
Seems to work OK for me (Pharo 5 on Mac OS)
'/tmp/foo.txt' asFileReference writeStreamDo: [ :out | out << 'Pharo' ].
'/tmp/foo.txt' asFileReference exists.
'/tmp/foo.txt' asFileReference renameTo: 'bar.txt'.
'/tmp/foo.txt' asFileReference exists.
'/tmp/bar.txt' asFileReference exists.
'/tmp/bar.txt' asFileReference contents.
Maybe a permission problem ?
Sven