-
Notifications
You must be signed in to change notification settings - Fork 161
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
ChangeDirectoryCurrent #364
Comments
I have no qualms about adding such a function, although of course the concept of a "current directory" is one that is fairly specific to Unix and Windows/DOS. But since most (all) desktop systems these days, there is probably no harm in ading that. I"d still like to see proper path abstraction in GAP, like e.g. Python's OS path, but I don't think one should withold a useful feature just because one day one might perhaps be able to do it "better". |
We already have DirectoryCurrent() so we're not adding exposure to any more concepts. |
yes!!! I've missed it yesterday having teaching GAP to an audience with users of Linux, OS X and Windows. This would make things easier. Thanks for reminding, I forgot that this exists in IO. Just tested, all works on Windows. Note that the correct name is |
If we want to do this, some care is needed to do it cleanly. The first step is to release a version of IO that only installs this function if it is not already bound. Once that is included in the distribution, we can update GAP to define this function. Are there other functions from IO where there is a strong case to migrate them at the same time without changing their names? |
I have added the relevant pull request to IO. This seems like the only future we could move from IO without a name change, as almost everything else starts IO_ |
To anyone interested in working on this, some notes:
|
Implementation notes:
static Obj FuncIO_chdir(Obj self, Obj pathname)
{
int res;
if (!IS_STRING(pathname) || !IS_STRING_REP(pathname)) {
SyClearErrorNo();
return Fail;
}
res = chdir(CSTR_STRING(pathname));
if (res < 0) {
SySetErrorNo();
return Fail;
}
return True;
}
|
While I appreciate the general caution at adding features in the "core" system or moving them from packages, I think
ChangeCurrentDirectory
from IO might be an exceptional case.Lots of people look for this functionality, and it's a trivial amount of code, while loading IO requires compiling a C module and may be problematic on systems that are far from POSIX.
One could argue for making IO a required package, but since it contains C code this would add a step to the minimal installation process and is extra tricky on Windows. It also requires loading a lot of code for (eg) pickling which most users will never need directly.
The text was updated successfully, but these errors were encountered: