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

[Windows] Let silent mode installer exit with errorlevel 1 when destination path contains spaces #463

Closed
a-cesari opened this issue Sep 23, 2021 · 2 comments
Labels
locked [bot] locked due to inactivity stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity

Comments

@a-cesari
Copy link

Dear all,
I noticed that if installing Anaconda on Windows via the GUI gives me a waring if trying to install on a path with spaces.
However if I try to do the same with the silent install method the installation goes on without giving any error.
As in our script we would like to stop if trying to install anaconda in a path with spaces, is there the possibility to implement this in the constructor? i.e. let the installation exit with %errorlevel% = 1 when spaces are detected?
Or, which is also ok for me, could you point to me which file should I modify to implement this change in my fork?

Thanks a lot,
Andrea

@jaimergp
Copy link
Contributor

jaimergp commented Aug 15, 2022

Hi @a-cesari!

The logic for Windows mainly consists of this NSIS script. Check the usage of the CheckForSpaces in different sections and make sure it's called when the installer is also run in silent mode.

This is the block you are looking for:

# Call the CheckForSpaces function.
Push $INSTDIR # Input string (install path).
Call CheckForSpaces
Pop $R0 # The function returns the number of spaces found in the input string.
#if check_path_spaces is True
# Check if any spaces exist in $INSTDIR.
StrCmp $R0 0 NoSpaces
# Plural if more than 1 space in $INSTDIR.
StrCmp $R0 1 0 +3
StrCpy $R1 ""
Goto +2
StrCpy $R1 "s"
# Show message box then take the user back to the Directory page.
MessageBox MB_OK|MB_ICONINFORMATION \
"Warning: 'Destination Folder' contains $R0 space$R1.$\n \
This can cause problems with several Conda packages.$\n \
Please consider removing the space$R1."
NoSpaces:
#endif

I would replace the warning with this logic (right above the NoSpaces: line)

        ${If} ${Silent}
            MessageBox MB_ICONSTOP "Spaces are not allowed in the installation path"
            Abort
        ${Else}
            # Show message box then take the user back to the Directory page.
            MessageBox MB_OK|MB_ICONINFORMATION \
                "Warning: 'Destination Folder' contains $R0 space$R1.$\n \
                This can cause problems with several Conda packages.$\n \
                Please consider removing the space$R1."
        ${EndIf}

@github-actions
Copy link

Hi there, thank you for your contribution!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed automatically if no further activity occurs.

If you would like this issue to remain open please:

  1. Verify that you can still reproduce the issue at hand
  2. Comment that the issue is still reproducible and include:
    - What OS and version you reproduced the issue on
    - What steps you followed to reproduce the issue

NOTE: If this issue was closed prematurely, please leave a comment.

Thanks!

@github-actions github-actions bot added the stale [bot] marked as stale due to inactivity label Aug 16, 2023
@github-actions github-actions bot added the stale::closed [bot] closed after being marked as stale label Sep 15, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 15, 2023
@github-project-automation github-project-automation bot moved this to 🏁 Done in 🧭 Planning Sep 15, 2023
@github-actions github-actions bot added the locked [bot] locked due to inactivity label Aug 21, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked [bot] locked due to inactivity stale::closed [bot] closed after being marked as stale stale [bot] marked as stale due to inactivity
Projects
Archived in project
Development

No branches or pull requests

2 participants