Skip to content

Initial working directory on OS x is set to user's home dir when R3 launched from Finder #2026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Siskin-Bot opened this issue Feb 15, 2020 · 2 comments
Labels

Comments

@Siskin-Bot
Copy link
Collaborator

Submitted by: adrians

When trying to target non-technical users, any steps other than double clicking on an executable is asking for trouble. On OS X, when an R3 executable is started by double clicking it in the Finder, the working directory is set to the user's home rather than the directory where the binary is located.

As an example, with RebolBot, the executable and the main script are placed together in a directory. When launching the binary, a non-technical user will need to change Rebol's working directory to where the executable was launched from and then run the main script. The changing of the working directory should not be necessary.


Imported from: CureCode [ Version: r3 master Type: Issue Platform: Mac OSX Category: Platform Reproduce: Always Fixed-in:none ]
Imported from: metaeducation#2026

Comments:

Rebolbot commented on Apr 17, 2013:

Submitted by: abolka

Unfortunately, there's nothing R3 can easily do about that, it's a "feature" of Finder: Finder changes the working directory to the user's home directory before executing the binary.


Rebolbot commented on Apr 17, 2013:

Submitted by: abolka

Note that this is part of a bigger portability problem, which will still need a bit of work (there are various open tickets about the correct setting of system/options fields).

On a more helpful note, when R3 is started with a script, it currently changes the working directory to the script's directory, so if you can set up an association in Finder to launch .r3 scripts via R3, then double-clicking on the main RebolBot script should work.


Rebolbot commented on Apr 17, 2013:

Submitted by: BrianH

There is a similar but unrelated problem in Windows with the same effect, which has another ticket.


Rebolbot commented on Apr 17, 2013:

Submitted by: abolka

Similar Windows problem: #1892


Rebolbot commented on Apr 17, 2013:

Submitted by: BrianH

Thanks for finding that. The Windows analog to this bug was discovered when I was trying to replicate the #! functionality on Windows using .cmd file tricks. Does OSX have this same problem for scripts launched using a #! line at the top of the script?


@Oldes
Copy link
Owner

Oldes commented Oct 14, 2021

Related to #2459

@Oldes
Copy link
Owner

Oldes commented Oct 14, 2021

Having associated *.r3 files with Terminal application and having rebol3 in /usr/local/bin/, double-clicking on script which looks like:

#!rebol3
Rebol []
probe what-dir
ask "DONE"

It properly reports working directory of the script.
With fixed #2459 there is also correct system/options/boot with absolute path to Rebol.
system/options/home should be now user's home dir, or directory defined by REBOL_HOME environment variable.

@Oldes Oldes closed this as completed Oct 14, 2021
Oldes added a commit to Oldes/Rebol3 that referenced this issue Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants