Skip to content
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

Consider .DIR attribute for current processes' working directory (CWD) #56

Open
TekWizely opened this issue Jul 22, 2022 · 0 comments
Open

Comments

@TekWizely
Copy link
Owner

With #55 adding .RUNFILE.DIR to track the primary runfile's parent directory, and .SELF.DIR to track the current (primary or otherwise) runfile's parent directory, it opens the door to possibly adding attributes for other useful directories.

One that comes to mind is the current processes' working directory (PWD / CWD).

NOTE: The CWD is not always the same as the Runfile's parent directory, as there are many ways to invoke a runfile from outside the user's current directory (shebang mode, runfile roots, etc).

Easy to get to already

As with .RUNFILE.DIR, the user's PWD is already easily achievable without an attribute:

Runfile

.DIR := ${PWD}

##
# export MY_DIR := ${.DIR}
#
pwd:
	echo $MY_DIR

Possibly Different Value

As the code would use Go's os.GetWd() method to retrieve the value for the attribute, there's a chance that the attribute value could differ from $PWD

However, Go does check and use $PWD if it appears to be correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant