From 7388c13c633ec6b570cd3090708dad4c716d71b7 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Wed, 7 Sep 2022 13:02:41 +0530 Subject: [PATCH] Check if the installation dir isn't at the top of a drive (on windows) and show a warning --- How to install and run.txt | 2 +- scripts/on_env_start.bat | 16 ++++++++++++++++ scripts/on_sd_start.bat | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/How to install and run.txt b/How to install and run.txt index 2f35d75b..e48d217c 100644 --- a/How to install and run.txt +++ b/How to install and run.txt @@ -1,6 +1,6 @@ Congrats on downloading Stable Diffusion UI, version 2! -If you haven't downloaded Stable Diffusion UI yet, please download from https://github.com/cmdr2/stable-diffusion-ui +If you haven't downloaded Stable Diffusion UI yet, please download from https://github.com/cmdr2/stable-diffusion-ui#installation After downloading, to install please follow these instructions: diff --git a/scripts/on_env_start.bat b/scripts/on_env_start.bat index 19a66e9f..60fe6eda 100644 --- a/scripts/on_env_start.bat +++ b/scripts/on_env_start.bat @@ -1,7 +1,23 @@ +@echo off + @echo. & echo "Stable Diffusion UI - v2" & echo. @cd .. +@>nul grep -c "conda_sd_ui_deps_installed" scripts\install_status.txt +@if "%ERRORLEVEL%" NEQ "0" ( + for /f "tokens=*" %%a in ('python -c "import os; parts = os.getcwd().split(os.path.sep); print(len(parts))"') do if "%%a" NEQ "2" ( + echo. & echo "!!!! WARNING !!!!" & echo. + echo "Your 'stable-diffusion-ui' folder is at %cd%" & echo. + echo "The 'stable-diffusion-ui' folder needs to be at the top of your drive, for e.g. 'C:\stable-diffusion-ui' or 'D:\stable-diffusion-ui' etc." + echo "Not placing this folder at the top of a drive can cause errors on some computers." + echo. & echo "Recommended: Please close this window and move the 'stable-diffusion-ui' folder to the top of a drive. For e.g. 'C:\stable-diffusion-ui'. Then run the installer again." & echo. + echo "Not Recommended: If you're sure that you want to install at the current location, please press any key to continue." & echo. + + pause + ) +) + @>nul grep -c "sd_ui_git_cloned" scripts\install_status.txt @if "%ERRORLEVEL%" EQU "0" ( @echo "Stable Diffusion UI's git repository was already installed. Updating.." diff --git a/scripts/on_sd_start.bat b/scripts/on_sd_start.bat index 4974f1b3..a9d95728 100644 --- a/scripts/on_sd_start.bat +++ b/scripts/on_sd_start.bat @@ -103,7 +103,10 @@ call WHERE uvicorn > .tmp pause exit /b ) +) +@>nul grep -c "sd_install_complete" ..\scripts\install_status.txt +@if "%ERRORLEVEL%" NEQ "0" ( @echo sd_weights_downloaded >> ..\scripts\install_status.txt @echo sd_install_complete >> ..\scripts\install_status.txt )