-
-
Notifications
You must be signed in to change notification settings - Fork 47
Allow user to set their default "home" directory at install time #10
Comments
One slight challenge to this is that the installer itself is not generally user-specific. It installs Sage for the whole system. That said, most Windows systems are going to be single-user in practice, so maybe we could still include this option at install time and have it only apply to the user running the installer. Not totally sure how I feel about that though. |
Since Windows already has the possibility of defining user environment variables, I suggest defining a specific Sagemath environment variable like SAGE_HOME to be set by the user which will indicate Sagemath where to start the folder system. |
Which config file can I edit currently to change SAGE_HOME? (env vars don't work ) |
It's not as simple as setting an environment variable, unfortunately, though that may not be a bad place to start. |
Yeah I already tried that :( I mean, which config file would I have to edit to change the home directory. |
@Akababa There is no |
I was referring to this from the comment in the link in OP:
Btw thanks for your hard work! |
Yes, but have some patience. Like I said, it's a bit tricky to get right and I need to make sure I know the right answer before I tell you. |
Jupyter's migrate script seems to have an encoding issue when the username contains diacritical marks. |
@vit-tucek Could you provide more details? I don't know what "Jupyter's migrate script" is. Anyways, that would not be directly related to this issue. Perhaps you could open a new one (or an issue with Jupyter). |
For those interested I've updated the description of this issue with a possible workaround that should work for individual users. It's not ideal but it's better than nothing. |
@embray Sorry, I was busy. Details are in the description of my pull request. |
@vit-tucek It looks like you closed that PR already? But indeed, I don't think that's the correct fix. However, you can always update an existing pull request by doing a force push ( That said, you might consider just opening an issue explaining how to reproduce the problem and someone on the Jupyter team can probably fix it. |
@embray Is By the way, thank you for writing up the workaround for this PR, because this is my first time using cygwin on W10 and without cygpath I would've been lost. |
Yes, you are only updating a branch on your personal fork of the repository. GitHub can handle updating the PR even when the contents of the branch are completely replaced. This is almost certainly preferable to opening lots of PRs and then closing them. FWIW I have a new version of the Windows installer coming out soon that I believe will make this a moot point, as it will work better for users with non-ASCII usernames (basically, it just sets your home directory to |
@embray That's great news. Thank you. I tried installing the new version (8.2) and my fix stopped working. Without my patch I get
With my patch applied.
|
I haven't made a release with the aforementioned fix yet. When I do it will be in the published changelog. |
@embray The problem is that the fix (which works flawlessly in 8.1) stopped working in 8.2 and unicode exceptions pop up all over the place. Did you make any changes to Cygwin? I'd check the published changelog but I have no idea where it is. :) |
I did some more digging and it seems that the problem to line 215 in
The variable Adding the following just before seems to fix the problem.
|
That's still something to do with Jupyter. |
The new SageMath 8.3 release allows you to set your default home directory for Sage at installation time, and also provides a script I'm still not sure it's ideal, but the approach I've taken of mapping your preferred home directory to the |
Windows more or less has a home directory in the form of
C:\Users\<username>
(at least this is the default, although Windows has a variable to refer to this directory's actual location for a given user that we use through Cygwin to set their home directory). Absent any other input this is generally the best choice, but it might not always be. As this question reminds us, some users may already have a preferred location, either under their home directory or somewhere else entirely, where they prefer to keep Sage-related files by default.It would be easy to change this for them at installation time by giving them the opportunity to set this path from something other than the default. Later we might also add a graphical configuration panel to change this (since the only alternative is editing some text config files). But I in the short term an install-time option should serve most cases.
Workaround
Most users can work around around this--especially if they are the only users of their machines (the most common case, really)--by editing the
/etc/fstab
file in the Sage+Cygwin install. The Windows path to this file is given by running the following in the Sage Shell:it should be the same as above for the default install location (and also dependent on the Sage version).
If you're familiar with Linux, this is similar to the
fstab
file there, with slightly different Cygwin-specific syntax and options.At the bottom of this file is a line:
which sets up the mappings for all users on the system. If you want
to add a specific mapping for your personal home directory, it should
work if you add under this line a similar line like:
e.g. on my machine this would be something like:
Be careful if your username contains spaces. In this case they have to be escaped like
\040
. I'm also not sure how this handles non-ASCII characters. I believe it can, but they might needs to be escaped as well.The text was updated successfully, but these errors were encountered: