forked from HackShardGaming/World-of-Valheim-Public
-
Notifications
You must be signed in to change notification settings - Fork 2
/
copyDll.bat
54 lines (44 loc) · 1.47 KB
/
copyDll.bat
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
@echo off
REM This is a script to copy the built DLL to a valheim client/server
REM for testing. Chenge the path to what you need for testing.
REM
REM Note: git will ignore changes
REM
ECHO "Running CopyDll Script"
REM Input Args
set APP_NAME=%1
set CONFIG=%2
REM Predetermine Paths
set CUR_DIR=%~dp0
set MOD_NAME=%APP_NAME%
set MOD_DIR=%CUR_DIR%\%MOD_NAME%
set MOD_DLL=%MOD_DIR%\bin\%CONFIG%\%MOD_NAME%.dll
set PACKAGE_DLL=%MOD_DIR%\Package\%MOD_NAME%.dll
set PLUGIN_DIR=BepInEx\plugins
set OUTPUT_DIR=%MOD_DIR%\Output
REM Development specific variables
set SERVER_DIR=C:\WindowsGSM\servers\1\serverfiles
set PLAYER_DIR=C:\Program Files (x86)\Steam\steamapps\common\Valheim
set "MOD_VER="
FOR /F "tokens=2 delims==" %%a in ('
wmic datafile where name^="%MOD_DLL:\=\\%" get Version /value
') do set "MOD_VER=%%a"
echo "VERSION: %MOD_VER%"
echo.
REM Commence with the copying
REM Send the mod to a server for testing.
echo "%MOD_DLL% -> %PACKAGE_DLL%"
copy "%MOD_DLL%" "%PACKAGE_DLL%"
if exist "%SERVER_DIR%\%PLUGIN_DIR%" (
echo "%MOD_DLL% -> %SERVER_DIR%\%PLUGIN_DIR%\%MOD_NAME%.dll"
copy "%MOD_DLL%" "%SERVER_DIR%\%PLUGIN_DIR%\%MOD_NAME%.dll"
) else (
echo "WARNING: Output Directory Does not exist."
)
REM Send the mod to the client for testing.
if exist "%PLAYER_DIR%\%PLUGIN_DIR%" (
echo "%MOD_DLL% -> %PLAYER_DIR%\%PLUGIN_DIR%\%MOD_NAME%.dll"
copy "%MOD_DLL%" "%PLAYER_DIR%\%PLUGIN_DIR%\%MOD_NAME%.dll"
) else (
echo "WARNING: Output Directory Does not exist."
)