Add way to query absolute path for current directory? #2794
Labels
kind: enhancement
Label for issues suggesting enhancements; and for pull requests implementing enhancements
Milestone
For a script, I wanted to temporarily change the current working directory and later restore it. I naively thought I could use record the value of
DirectoryCurrent()
, then callChangeDirectoryCurrent
(from the IO package), and later restore to the stored path.But that doesn't work, because
DirectoryCurrent()
always returns the same thing:dir("./")
.I found no way to get the CWD, in particular no calls to
getwd
orgetcwd
in GAP or IO (well, GAP now has one in the internal functionfind_yourself
, but that's not helpful).There is
GAPInfo.SystemEnvironment.PWD
, but that isn't updated ifChangeDirectoryCurrent
is called, so it's only helpful if no code before mine changed the CWD.For now, I'll resort to using
Process
to executedpwd
in a shell. But I really think we should add something here that does this in a more straightforward way.BTW, I also noticed that @ChrisJefferson back in 2015 changed
io
to only definedChangeDirectoryCurrent
if it wasn't defined already -- my guess is in order to add this function to the GAP library. But that hasn't happened, has it?The text was updated successfully, but these errors were encountered: