Hi all, I'm new to Smalltalk and Pharo, so be kind ;-) I've tried Google and searching the world.st forum but I couldn't find the answer to the following question: I looks like the default working directory of my MacOS Pharo instance is a path inside the Pharo5.0.app: /Applications/Pharo5.0.app/Contents/Resources This causes that Pharo can't write to that path and soms default tests are trying to do exactly that: testFileExists | file | file := File named: 'asd.txt'. file writeStream close. self assert: file exists. file delete Of course I could edit the tests, but I would rather change the default working directory. Is this possible? Greetings Wouter -- View this message in context: http://forum.world.st/Default-working-directory-tp4919393.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
I think it defaults to where you image is, but you can inspect FileSystem workingDirectory in Playground and see for yourself :) On Wed, Oct 19, 2016 at 1:51 PM, wvzuilen <wvzuilen@gmail.com> wrote:
Hi all,
I'm new to Smalltalk and Pharo, so be kind ;-) I've tried Google and searching the world.st forum but I couldn't find the answer to the following question:
I looks like the default working directory of my MacOS Pharo instance is a path inside the Pharo5.0.app: /Applications/Pharo5.0.app/Contents/Resources
This causes that Pharo can't write to that path and soms default tests are trying to do exactly that:
testFileExists | file | file := File named: 'asd.txt'. file writeStream close. self assert: file exists. file delete
Of course I could edit the tests, but I would rather change the default working directory. Is this possible?
Greetings Wouter
-- View this message in context: http://forum.world.st/Default- working-directory-tp4919393.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
In the default Pharo macOS download the image file is embedded inside the Pharo.app package. Are you suggesting that I use a separate image file that I place at a location where I can write files? -- View this message in context: http://forum.world.st/Default-working-directory-macOS-tp4919393p4919403.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
I suppose you should do that, I am relatively new to Pharo either, and a Windows user (by force, not because I want, lets be clear :) ), but in a Mac or Linux I think I would use try Pharo Launcher, where you can manage you images. In windows I create a new directory and copy the default image there. On Wed, Oct 19, 2016 at 2:46 PM, wvzuilen <wvzuilen@gmail.com> wrote:
In the default Pharo macOS download the image file is embedded inside the Pharo.app package. Are you suggesting that I use a separate image file that I place at a location where I can write files?
-- View this message in context: http://forum.world.st/Default- working-directory-macOS-tp4919393p4919403.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Ahh, look, FileSystem has a workingDirectoryPath:, you could change the working directory using that. On Wed, Oct 19, 2016 at 3:06 PM, Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
I suppose you should do that, I am relatively new to Pharo either, and a Windows user (by force, not because I want, lets be clear :) ), but in a Mac or Linux I think I would use try Pharo Launcher, where you can manage you images. In windows I create a new directory and copy the default image there.
On Wed, Oct 19, 2016 at 2:46 PM, wvzuilen <wvzuilen@gmail.com> wrote:
In the default Pharo macOS download the image file is embedded inside the Pharo.app package. Are you suggesting that I use a separate image file that I place at a location where I can write files?
-- View this message in context: http://forum.world.st/Default- working-directory-macOS-tp4919393p4919403.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
Esteban, yes, I could use save as..., its pretty much the same thing, no? On Wed, Oct 19, 2016 at 3:16 PM, Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
Ahh, look, FileSystem has a workingDirectoryPath:, you could change the working directory using that.
On Wed, Oct 19, 2016 at 3:06 PM, Vitor Medina Cruz <vitormcruz@gmail.com> wrote:
I suppose you should do that, I am relatively new to Pharo either, and a Windows user (by force, not because I want, lets be clear :) ), but in a Mac or Linux I think I would use try Pharo Launcher, where you can manage you images. In windows I create a new directory and copy the default image there.
On Wed, Oct 19, 2016 at 2:46 PM, wvzuilen <wvzuilen@gmail.com> wrote:
In the default Pharo macOS download the image file is embedded inside the Pharo.app package. Are you suggesting that I use a separate image file that I place at a location where I can write files?
-- View this message in context: http://forum.world.st/Default- working-directory-macOS-tp4919393p4919403.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
I've tried that. Like this: FileSystem disk workingDirectoryPath: Path / 'Users/myusername/Desktop'. As expected it changes my working directory, but the test mentioned in my first post still fails. ?!? -- View this message in context: http://forum.world.st/Default-working-directory-macOS-tp4919393p4919408.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
I think file writeStream of File does not honor FileSystem configuration. In the end of the message chain you have the primitive call "primOpen: fileName writable: writableFlag". Try changing your test code to this: testFileExists | file | file := FileSystem workingDirectory / 'asd.txt'. file writeStream close. self assert: file exists. file delete This should work. I don't know, however, if that is the best practice or not. On Wed, Oct 19, 2016 at 3:33 PM, wvzuilen <wvzuilen@gmail.com> wrote:
I've tried that. Like this: FileSystem disk workingDirectoryPath: Path / 'Users/myusername/Desktop'. As expected it changes my working directory, but the test mentioned in my first post still fails. ?!?
-- View this message in context: http://forum.world.st/Default- working-directory-macOS-tp4919393p4919408.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
you cannot do a âsave asâ¦â and use it later?
On 19 Oct 2016, at 18:46, wvzuilen <wvzuilen@gmail.com> wrote:
In the default Pharo macOS download the image file is embedded inside the Pharo.app package. Are you suggesting that I use a separate image file that I place at a location where I can write files?
-- View this message in context: http://forum.world.st/Default-working-directory-macOS-tp4919393p4919403.html Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.
participants (3)
-
Esteban Lorenzano -
Vitor Medina Cruz -
wvzuilen