Skip to content

Commit c123961

Browse files
committed
fix: make sure no spaces are in repository directory
1 parent bcf3ce3 commit c123961

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

utils/windows-installer/pixi_installer.nsi

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,16 @@ Function RepositoryPageLeave
214214
# Get the directory
215215
${NSD_GetText} $DirRequest $REPO_DIR
216216

217+
# Check for spaces in path (causes issues with Snakemake)
218+
Push $REPO_DIR
219+
Call CheckForSpaces
220+
Pop $0
221+
${If} $0 > 0
222+
MessageBox MB_OK|MB_ICONEXCLAMATION \
223+
"The repository path contains spaces, which will cause problems with Snakemake.$\n$\nPlease choose a path without spaces.$\n$\nCurrent path: $REPO_DIR"
224+
Abort
225+
${EndIf}
226+
217227
# Store in registry for later use by launcher scripts
218228
WriteRegStr HKCU "Software\${PRODUCT_NAME}" "RepositoryPath" "$REPO_DIR"
219229

@@ -513,6 +523,30 @@ SectionEnd
513523
# Functions
514524
# ------------------------------------------------------------------------------
515525

526+
# Check for spaces in a directory path
527+
# http://nsis.sourceforge.net/Check_for_spaces_in_a_directory_path
528+
Function CheckForSpaces
529+
Exch $R0
530+
Push $R1
531+
Push $R2
532+
Push $R3
533+
StrCpy $R1 -1
534+
StrCpy $R3 $R0
535+
StrCpy $R0 0
536+
loop:
537+
StrCpy $R2 $R3 1 $R1
538+
IntOp $R1 $R1 - 1
539+
StrCmp $R2 "" done
540+
StrCmp $R2 " " 0 loop
541+
IntOp $R0 $R0 + 1
542+
Goto loop
543+
done:
544+
Pop $R3
545+
Pop $R2
546+
Pop $R1
547+
Exch $R0
548+
FunctionEnd
549+
516550
# Function to remove a directory quickly using cmd RMDIR followed by NSIS RMDir
517551
# Parameters:
518552
# $0 - Directory path to remove

0 commit comments

Comments
 (0)