  
      ${If} $InstallFailed == 1
          Call Abort
      ${Else}
          DetailPrint "All Prerequisites installed."
      ${EndIf}
  FunctionEnd
  
  Function CloneRepo
      DetailPrint "Downloading Faceswap..."
      SetDetailsPrint listonly
      ${If} $InstallGit == 1
          StrCpy $9 "$\"$PROGRAMFILES64\git\bin\git.exe$\""
      ${Else}
          StrCpy $9 "git"
      ${EndIf}
      ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$9 clone ${flagsRepo} $\"$INSTDIR$\""
      pop $0
      ExecDos::wait $0
      pop $0
      SetDetailsPrint both
      ${If} $0 != 0
          DetailPrint "Error Downloading Faceswap"
          Call Abort
      ${EndIf}
  FunctionEnd
  
  Function SetEnvironment
      DetailPrint "Initializing Conda..."
 
</s> remove Function InstallPrerequisites
    # GIT
        ${If} $InstallGit == 1
            DetailPrint "Downloading Git..."
            inetc::get /caption "Downloading Git..." /canceltext "Cancel" ${wwwGit} "git_installer.exe" /end
            Pop $0 # return value = exit code, "OK" means OK
            ${If} $0 == "OK"
                DetailPrint "Installing Git..."
                SetDetailsPrint listonly
                ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$\"$dirTemp\git_installer.exe$\" ${flagsGit} /LOADINF=$\"$gitInf$\""
                pop $0
                ExecDos::wait $0
                pop $0
                SetDetailsPrint both
                ${If} $0 != 0
                    DetailPrint "Error Installing Git"
                    StrCpy $InstallFailed 1
                ${EndIf}
            ${Else}
                DetailPrint "Error Downloading Git"
                StrCpy $InstallFailed 1
            ${EndIf}
        ${EndIf}

    # CONDA
        ${If} $InstallConda == 1
            DetailPrint "Downloading Miniconda3..."
            inetc::get /caption "Downloading Miniconda3." /canceltext "Cancel" ${wwwConda} "Miniconda3.exe" /end
            Pop $0
            ${If} $0 == "OK"
                DetailPrint "Installing Miniconda3. This will take a few minutes..."
                SetDetailsPrint listonly
                ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$\"$dirTemp\Miniconda3.exe$\" ${flagsConda}"
                pop $0
                ExecDos::wait $0
                pop $0
                StrCpy $dirConda "$dirMiniconda"
                SetDetailsPrint both
                ${If} $0 != 0
                    DetailPrint "Error Installing Miniconda3"
                    StrCpy $InstallFailed 1
                ${EndIf}
            ${Else}
                DetailPrint "Error Downloading Miniconda3"
 </s> add Function InstallConda
    ${If} $InstallConda == 1
        DetailPrint "Downloading Miniconda3..."
        inetc::get /caption "Downloading Miniconda3." /canceltext "Cancel" ${wwwConda} "Miniconda3.exe" /end
        Pop $0
        ${If} $0 == "OK"
            DetailPrint "Installing Miniconda3. This will take a few minutes..."
            SetDetailsPrint listonly
            ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$\"$dirTemp\Miniconda3.exe$\" ${flagsConda}"
            pop $0
            ExecDos::wait $0
            pop $0
            StrCpy $dirConda "$dirMiniconda"
            SetDetailsPrint both
            ${If} $0 != 0
                DetailPrint "Error Installing Miniconda3" </s> remove     ; Create a temporary .bat file for setting up faceswap so the path can be set for Git
    ; Required for installing pynvml from github
    FileOpen $9 "$dirTemp\_install_faceswap.bat" w
    ${If} $InstallGit == 1
        FileWrite $9 "SET PATH=%PATH%;$PROGRAMFILES64\git\cmd$\r$\n"
    ${EndIf}
    FileWrite $9 "$\"$dirConda\scripts\activate.bat$\" && conda activate $\"$envName$\" && python $\"$INSTDIR\setup.py$\" $0 && conda deactivate$\r$\n"
    FileClose $9

    ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$\"$dirTemp\_install_faceswap.bat$\""
 </s> add     ExecDos::exec /NOUNLOAD /ASYNC /DETAILED "$\"$dirConda\scripts\activate.bat$\" && conda activate $\"$envName$\" && python $\"$INSTDIR\setup.py$\" $0 && conda deactivate" </s> remove     #Git
        nsExec::ExecToStack "git --version"
        pop $0
        pop $1
        ${If} $0 == 0
            StrCpy $Log "$log(check) Git installed: $1"
        ${Else}
            StrCpy $InstallGit 1
        ${EndIf}

 </s> add  </s> remove Function DesktopShortcut
    DetailPrint "Creating Desktop Shortcut"
 </s> add Function AddGuiLauncher
    DetailPrint "Creating GUI Launcher"
        DetailPrint "Miniconda3 installed."
  
      ${If} $InstallFailed == 1
          Call Abort
      ${Else}
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
        DetailPrint "Miniconda3 installed."
      ${EndIf}
  FunctionEnd
  
  Function SetEnvironment
      DetailPrint "Initializing Conda..."
keep keep keep keep replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace replace keep keep keep keep keep
 Installer updates
Windows - Install Conda git
Linux + Windows - Always create GUI Launcher shortcut 
.install/windows/install.nsi