Default working directory macOS

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

Default working directory macOS

wvzuilen
This post was updated on .
CONTENTS DELETED
The author has deleted this message.
Reply | Threaded
Open this post in threaded view
|

Re: Default working directory

Vitor Medina Cruz
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 <[hidden email]> 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.


Reply | Threaded
Open this post in threaded view
|

Re: Default working directory

wvzuilen
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?
Reply | Threaded
Open this post in threaded view
|

Re: Default working directory

Vitor Medina Cruz
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 <[hidden email]> 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.


Reply | Threaded
Open this post in threaded view
|

Re: Default working directory

EstebanLM
In reply to this post by wvzuilen
you cannot do a “save as…” and use it later?

> On 19 Oct 2016, at 18:46, wvzuilen <[hidden email]> 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.
>


Reply | Threaded
Open this post in threaded view
|

Re: Default working directory

Vitor Medina Cruz
In reply to this post by Vitor Medina Cruz
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 <[hidden email]> 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 <[hidden email]> 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.



Reply | Threaded
Open this post in threaded view
|

Re: Default working directory

Vitor Medina Cruz
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 <[hidden email]> 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 <[hidden email]> 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 <[hidden email]> 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.




Reply | Threaded
Open this post in threaded view
|

Re: Default working directory

wvzuilen
In reply to this post by Vitor Medina Cruz
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. ?!?
Reply | Threaded
Open this post in threaded view
|

Re: Default working directory

Vitor Medina Cruz
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 <[hidden email]> 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.