💥 MAJOR UPDATE: Windows compatibility fixes + executable + installer

This commit is contained in:
2025-09-24 11:14:24 +02:00
commit 8cd0c1fbd4
25 changed files with 5492 additions and 0 deletions

319
installer.nsi Normal file
View File

@@ -0,0 +1,319 @@
; OverCode Shell NSIS Installer Script
; Creates a professional Windows installer with shortcuts and uninstaller
!define PRODUCT_NAME "OverCode Shell"
!define PRODUCT_VERSION "2.0.0-ULTRA"
!define PRODUCT_PUBLISHER "OverCode Development Team"
!define PRODUCT_WEB_SITE "https://github.com/overcode-dev/overcode-shell"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\OverCodeShell.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!include "MUI2.nsh"
; MUI Settings
!define MUI_ABORTWARNING
!define MUI_ICON "overcode.ico"
!define MUI_UNICON "overcode.ico"
; Welcome page
!insertmacro MUI_PAGE_WELCOME
; License page
!define MUI_LICENSEPAGE_RADIOBUTTONS
!insertmacro MUI_PAGE_LICENSE "LICENSE.txt"
; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Components page
!insertmacro MUI_PAGE_COMPONENTS
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!define MUI_FINISHPAGE_RUN "$INSTDIR\OverCodeShell.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt"
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
; Language files
!insertmacro MUI_LANGUAGE "English"
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "OverCodeShell-Installer-v${PRODUCT_VERSION}.exe"
InstallDir "$PROGRAMFILES\OverCode Shell"
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
ShowInstDetails show
ShowUnInstDetails show
RequestExecutionLevel admin
Section "Core Files (Required)" SEC01
SectionIn RO
SetOutPath "$INSTDIR"
SetOverwrite on
; Main executable
File "dist\OverCodeShell.exe"
; Create application data directory
CreateDirectory "$APPDATA\OverCode"
; Create shortcuts
CreateDirectory "$SMPROGRAMS\OverCode Shell"
CreateShortCut "$SMPROGRAMS\OverCode Shell\OverCode Shell.lnk" "$INSTDIR\OverCodeShell.exe"
CreateShortCut "$SMPROGRAMS\OverCode Shell\Uninstall.lnk" "$INSTDIR\uninst.exe"
CreateShortCut "$DESKTOP\OverCode Shell.lnk" "$INSTDIR\OverCodeShell.exe"
SectionEnd
Section "Launcher Scripts" SEC02
SetOutPath "$INSTDIR"
File "launch_overcode.bat"
File "launch_overcode.ps1"
; Create shortcuts for launchers
CreateShortCut "$SMPROGRAMS\OverCode Shell\Launch (Batch).lnk" "$INSTDIR\launch_overcode.bat"
CreateShortCut "$SMPROGRAMS\OverCode Shell\Launch (PowerShell).lnk" "powershell.exe" '-ExecutionPolicy Bypass -File "$INSTDIR\launch_overcode.ps1"'
SectionEnd
Section "Python Source Files" SEC03
SetOutPath "$INSTDIR\source"
File "overshell.py"
File "over_interpreter.py"
File "requirements.txt"
File /r "commands"
File /r "utils"
; Setup script
File "setup.py"
CreateShortCut "$SMPROGRAMS\OverCode Shell\Setup Environment.lnk" "python.exe" '"$INSTDIR\source\setup.py"'
SectionEnd
Section "Documentation" SEC04
SetOutPath "$INSTDIR\docs"
; Create README if it doesn't exist
FileOpen $0 "$INSTDIR\docs\README.txt" w
FileWrite $0 "OverCode Shell v${PRODUCT_VERSION}$\r$\n"
FileWrite $0 "Enhanced Polyglot Programming Environment$\r$\n$\r$\n"
FileWrite $0 "To run OverCode Shell:$\r$\n"
FileWrite $0 "1. Double-click OverCodeShell.exe$\r$\n"
FileWrite $0 "2. Or use the Start Menu shortcuts$\r$\n$\r$\n"
FileWrite $0 "Features:$\r$\n"
FileWrite $0 "- Multi-language code execution$\r$\n"
FileWrite $0 "- Built-in games and demos$\r$\n"
FileWrite $0 "- Customizable themes$\r$\n"
FileWrite $0 "- Discord Rich Presence$\r$\n"
FileWrite $0 "- Package management$\r$\n$\r$\n"
FileWrite $0 "For support, visit: ${PRODUCT_WEB_SITE}$\r$\n"
FileClose $0
SectionEnd
Section "Add to PATH" SEC05
; Add installation directory to system PATH
Push "$INSTDIR"
Call AddToPath
SectionEnd
Section -AdditionalIcons
WriteIniStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
CreateShortCut "$SMPROGRAMS\OverCode Shell\Website.lnk" "$INSTDIR\${PRODUCT_NAME}.url"
SectionEnd
Section -Post
WriteUninstaller "$INSTDIR\uninst.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\OverCodeShell.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\OverCodeShell.exe"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
SectionEnd
; Component descriptions
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Core OverCode Shell executable and essential files"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Batch and PowerShell launcher scripts for development"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "Python source files for developers and customization"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC04} "Documentation and help files"
!insertmacro MUI_DESCRIPTION_TEXT ${SEC05} "Add OverCode to system PATH for command-line access"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd
Function un.onInit
MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
Abort
FunctionEnd
Section Uninstall
Delete "$INSTDIR\${PRODUCT_NAME}.url"
Delete "$INSTDIR\uninst.exe"
Delete "$INSTDIR\OverCodeShell.exe"
Delete "$INSTDIR\launch_overcode.bat"
Delete "$INSTDIR\launch_overcode.ps1"
; Remove source files
RMDir /r "$INSTDIR\source"
RMDir /r "$INSTDIR\docs"
Delete "$SMPROGRAMS\OverCode Shell\Uninstall.lnk"
Delete "$SMPROGRAMS\OverCode Shell\Website.lnk"
Delete "$SMPROGRAMS\OverCode Shell\OverCode Shell.lnk"
Delete "$SMPROGRAMS\OverCode Shell\Launch (Batch).lnk"
Delete "$SMPROGRAMS\OverCode Shell\Launch (PowerShell).lnk"
Delete "$SMPROGRAMS\OverCode Shell\Setup Environment.lnk"
RMDir "$SMPROGRAMS\OverCode Shell"
Delete "$DESKTOP\OverCode Shell.lnk"
RMDir "$INSTDIR"
; Remove from PATH
Push "$INSTDIR"
Call un.RemoveFromPath
DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
SetAutoClose true
SectionEnd
; PATH modification functions
!include "WinMessages.nsh"
Function AddToPath
Exch $0
Push $1
Push $2
Push $3
# don't add if the path doesn't exist
IfFileExists "$0\*.*" "" AddToPath_done
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
Push "$1;"
Push "$0;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
Push "$1;"
Push "$0\;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
GetFullPathName /SHORT $3 $0
Push "$1;"
Push "$3;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
Push "$1;"
Push "$3\;"
Call StrStr
Pop $2
StrCmp $2 "" "" AddToPath_done
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" "$1;$0"
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
AddToPath_done:
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
Function un.RemoveFromPath
Exch $0
Push $1
Push $2
Push $3
Push $4
Push $5
Push $6
IntFmt $6 "%c" 26 # DOS EOF
ReadRegStr $1 HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH"
StrCpy $5 $1 1 -1 # copy last char
StrCmp $5 ";" +2 # if last char != ;
StrCpy $1 "$1;" # append ;
Push $1
Push "$0;"
Call un.StrStr # Find `$0;` in $1
Pop $2 # pos of our dir
StrCmp $2 "" unRemoveFromPath_done
; else, it is in path
# $0 - path to add
# $1 - path var
StrLen $3 "$0;"
StrLen $4 $2
StrCpy $5 $1 -$4 # $5 is now the part before the path to remove
StrCpy $6 $2 "" $3 # $6 is now the part after the path to remove
StrCpy $3 $5$6
StrCpy $5 $3 1 -1 # copy last char
StrCmp $5 ";" 0 +2 # if last char == ;
StrCpy $3 $3 -1 # remove last char
WriteRegExpandStr HKLM "SYSTEM\CurrentControlSet\Control\Session Manager\Environment" "PATH" $3
SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
unRemoveFromPath_done:
Pop $6
Pop $5
Pop $4
Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd
Function StrStr
Exch $R1 # st=haystack,old$R1, $R1=needle
Exch # st=old$R1,haystack
Exch $R2 # st=old$R1,old$R2, $R2=haystack
Push $R3
Push $R4
Push $R5
StrLen $R3 $R1
StrCpy $R4 0
loop:
StrCpy $R5 $R2 $R3 $R4
StrCmp $R5 $R1 done
StrCmp $R5 "" done
IntOp $R4 $R4 + 1
Goto loop
done:
StrCpy $R1 $R2 "" $R4
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Exch $R1
FunctionEnd
Function un.StrStr
Exch $R1 # st=haystack,old$R1, $R1=needle
Exch # st=old$R1,haystack
Exch $R2 # st=old$R1,old$R2, $R2=haystack
Push $R3
Push $R4
Push $R5
StrLen $R3 $R1
StrCpy $R4 0
loop:
StrCpy $R5 $R2 $R3 $R4
StrCmp $R5 $R1 done
StrCmp $R5 "" done
IntOp $R4 $R4 + 1
Goto loop
done:
StrCpy $R1 $R2 "" $R4
Pop $R5
Pop $R4
Pop $R3
Pop $R2
Exch $R1
FunctionEnd