-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdate_game_steam.bat
More file actions
73 lines (56 loc) · 1.68 KB
/
update_game_steam.bat
File metadata and controls
73 lines (56 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET RETVALUE=-1
IF "%1"=="" (
ECHO ERROR: Please provide Steam App ID as first parameter
GOTO END
)
IF "%2"=="" (
ECHO ERROR: Please provide app directory as second parameter - likely within steamapps\common
GOTO END
)
SET APP_INSTALL_DIR=%2\
IF NOT EXIST !APP_INSTALL_DIR! (
ECHO ERROR: Install directory not found: !APP_INSTALL_DIR!
GOTO END
)
SET STEAMCMD=%~dp0\steamcmd\steamcmd.exe
IF NOT EXIST !STEAMCMD! (
ECHO Expected: steamcmd located in !STEAMCMD!
GOTO END
)
SET APPID=%1
SET APPINFO_DIR=%~dp0\appinfo
SET APPINFO_FILE=!APPINFO_DIR!\!APPID!
SET APPINFO_FILE_NEW=!APPINFO_FILE!-new
IF NOT EXIST !APPINFO_DIR!\ MKDIR !APPINFO_DIR!
ECHO Checking for needed updates for game id !APPID!
CALL curl https://api.steamcmd.net/v1/info/!APPID! --silent --output !APPINFO_FILE_NEW!
IF !ERRORLEVEL! NEQ 0 (
ECHO Error getting app info for game
GOTO END
)
SET NEEDS_UPDATE=1
IF EXIST !APPINFO_FILE! (
CALL FC !APPINFO_FILE! !APPINFO_FILE_NEW! > NUL
IF !ERRORLEVEL! EQU 0 SET NEEDS_UPDATE=0
)
IF !NEEDS_UPDATE! NEQ 0 (
ECHO Update required, installing to !APP_INSTALL_DIR!
CALL !STEAMCMD! +force_install_dir !APP_INSTALL_DIR! +login anonymous +app_update !APPID! validate +quit
IF !ERRORLEVEL! NEQ 0 (
ECHO Error updating app via steamcmd
GOTO END
)
MOVE !APPINFO_FILE_NEW! !APPINFO_FILE! > NUL
ECHO Version out-of-date, returning 1
SET RETVALUE=1
GOTO END
) ELSE (
ECHO Version up-to-date, returning 0
DEL !APPINFO_FILE_NEW!
SET RETVALUE=0
GOTO END
)
:END
EXIT /B !RETVALUE!