-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path_deployMe.bat
More file actions
60 lines (39 loc) · 1.35 KB
/
Copy path_deployMe.bat
File metadata and controls
60 lines (39 loc) · 1.35 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
@ECHO OFF
REM GET CURRENT NAMES AND VERSIONS
SET folderpath=%cd%
SET batchfilename=%~n0%~x0
SET factoriofolder=C:\FactorioModding
REM GET VERSION AND MOD NAME FROM INFO FILE
for /f "tokens=2 delims=:" %%a in ('type "%folderpath%\info.json"^|find "version"') do (
set version=%%a & goto :continueVersion
)
:continueVersion
set version=%version:~1,-2%
for /f "tokens=2 delims=:" %%a in ('type "%folderpath%\info.json"^|find "name"') do (
set modname=%%a & goto :continueModName
)
:continueModName
set modname=%modname:~1,-2%
SET modfoldername=%modname%_%version%
REM REMOVE OLD FOLDER
for /F "delims= eol=|" %%f in ('
dir "C:\FactorioModding\mods" /B /A:D ^| findstr /I "^%modname%_[0-9]*\.[0-9]*\.[0-9]*$"
') do (
RMDIR /S /Q "C:\FactorioModding\mods"\%%f
)
REM CREATE EXCLUDE FILES LIST
ECHO .bat >> excludedfileslist.txt
ECHO .xcf >> excludedfileslist.txt
ECHO notes >> excludedfileslist.txt
ECHO .vscode >> excludedfileslist.txt
ECHO excludedfileslist.txt >> excludedfileslist.txt
REM BESPOKE EXCLUDES FOR THIS PROJECT
ECHO _documentation\images >> excludedfileslist.txt
REM COPY THE FILES
XCOPY "%folderpath%" "%factoriofolder%\mods\%modfoldername%" /S /E /Y /I /Q /EXCLUDE:excludedfileslist.txt
REM DELETE THE EXCLUDE FILES LIST
DEL /q excludedfileslist.txt
REM DELETE OLD SCRIPT OUTPUT
DEL /q %factoriofolder%\script-output\
ECHO Done
TIMEOUT 2