run icon indicating copy to clipboard operation
run copied to clipboard

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

Open TekWizely opened this issue 3 years ago • 0 comments

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.

TekWizely avatar Jul 22 '22 16:07 TekWizely