Skip to content

Commit 37ea28b

Browse files
committed
fix: refine directory existence checks and logging in Windows script
- Updated directory existence checks to use wildcard matching for improved reliability. - Enhanced logging to utilize delayed variable expansion for clearer output during execution. - Ensured consistent logging of chosen directory and log file paths for better visibility.
1 parent e9a5afd commit 37ea28b

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

  • apps/portal/src/app/api/download-agent/scripts

apps/portal/src/app/api/download-agent/scripts/windows.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,14 @@ echo.
8989
9090
REM Choose writable directory
9191
call :log_msg "Choosing destination directory; primary=%PRIMARY_DIR% fallback=%FALLBACK_DIR%"
92-
if exist "%PRIMARY_DIR%\\NUL" set "CHOSEN_DIR=%PRIMARY_DIR%"
92+
if exist "%PRIMARY_DIR%\\*" set "CHOSEN_DIR=%PRIMARY_DIR%"
9393
if not defined CHOSEN_DIR call :log_run mkdir "%PRIMARY_DIR%"
94-
if not defined CHOSEN_DIR if exist "%PRIMARY_DIR%\\NUL" set "CHOSEN_DIR=%PRIMARY_DIR%"
94+
if not defined CHOSEN_DIR if exist "%PRIMARY_DIR%\\*" set "CHOSEN_DIR=%PRIMARY_DIR%"
9595
9696
if not defined CHOSEN_DIR call :log_msg "Primary not available; trying fallback"
97-
if not defined CHOSEN_DIR if exist "%FALLBACK_DIR%\\NUL" set "CHOSEN_DIR=%FALLBACK_DIR%"
97+
if not defined CHOSEN_DIR if exist "%FALLBACK_DIR%\\*" set "CHOSEN_DIR=%FALLBACK_DIR%"
9898
if not defined CHOSEN_DIR call :log_run mkdir "%FALLBACK_DIR%"
99-
if not defined CHOSEN_DIR if exist "%FALLBACK_DIR%\\NUL" set "CHOSEN_DIR=%FALLBACK_DIR%"
99+
if not defined CHOSEN_DIR if exist "%FALLBACK_DIR%\\*" set "CHOSEN_DIR=%FALLBACK_DIR%"
100100
101101
if not defined CHOSEN_DIR (
102102
color 0E
@@ -121,7 +121,7 @@ if not defined CHOSEN_DIR (
121121
)
122122
call :log_msg "Using directory: !MARKER_DIR!"
123123
)
124-
echo Logs will be written to: %LOG_FILE%
124+
echo Logs will be written to: !LOG_FILE!
125125
echo.
126126
127127
REM Write marker files
@@ -192,8 +192,8 @@ if "%HAS_ERROR%"=="0" (
192192
color 0A
193193
echo RESULT: SUCCESS
194194
echo Setup completed successfully for %EMPLOYEE_ID%.
195-
if defined CHOSEN_DIR echo Files created in: %CHOSEN_DIR%
196-
echo Log file: %LOG_FILE%
195+
if defined CHOSEN_DIR echo Files created in: !CHOSEN_DIR!
196+
echo Log file: !LOG_FILE!
197197
call :log_msg "RESULT: SUCCESS"
198198
) else (
199199
color 0C
@@ -204,7 +204,7 @@ if "%HAS_ERROR%"=="0" (
204204
echo.
205205
echo Next steps:
206206
echo - Take a screenshot of this window.
207-
echo - Attach the log file from: %LOG_FILE%
207+
echo - Attach the log file from: !LOG_FILE!
208208
echo - Share both with your CompAI support contact.
209209
call :log_msg "RESULT: COMPLETED WITH ISSUES (exit=%EXIT_CODE%)"
210210
)

0 commit comments

Comments
 (0)