-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResourceKeyGeneration.bat
More file actions
71 lines (57 loc) · 1.74 KB
/
ResourceKeyGeneration.bat
File metadata and controls
71 lines (57 loc) · 1.74 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
@echo off
rem Check if arguments are provided
if "%1"=="" (
echo Error: EXE argument is missing.
exit /b 1
)
if "%2"=="" (
echo Error: RESX_FILE argument is missing.
exit /b 1
)
if "%3"=="" (
echo Error: KEYS_OUTPUT_FILE argument is missing.
exit /b 1
)
if "%4"=="" (
echo Error: PAIRS_OUTPUT_FILE argument is missing.
exit /b 1
)
if "%5"=="" (
echo Error: NAMESPACE argument is missing.
exit /b 1
)
rem Assign arguments to variables
set "RESX_FILE=%2"
set "OUTPUT_FILE=%3"
rem pause
rem Resolve relative paths to absolute paths
for %%I in ("%RESX_FILE%") do set "RESX_FILE=%%~fI"
for %%I in ("%OUTPUT_FILE%") do set "OUTPUT_FILE=%%~fI"
rem Debugging output for absolute paths
rem echo RESX_FILE (absolute path): %RESX_FILE%
rem echo OUTPUT_FILE (absolute path): %OUTPUT_FILE%
rem pause
rem Check if the RESX file exists
if not exist "%RESX_FILE%" (
echo Error: RESX_FILE "%RESX_FILE%" does not exist.
exit /b 1
)
rem Check if the OUTPUT_FILE exists
if not exist "%OUTPUT_FILE%" (
echo OUTPUT_FILE "%OUTPUT_FILE%" does not exist. It needs generation.
"%1" "%2" "%3" "%4" "%5"
exit /b 0
)
rem Use PowerShell to get the full timestamp with seconds
for /f "delims=" %%I in ('powershell -command "(Get-Item '%RESX_FILE%').LastWriteTime"') do set "RESX_DATE=%%I"
for /f "delims=" %%I in ('powershell -command "(Get-Item '%OUTPUT_FILE%').LastWriteTime"') do set "OUTPUT_DATE=%%I"
rem Compare timestamps
rem echo RESX_FILE Last Modified: %RESX_DATE%
rem echo OUTPUT_FILE Last Modified: %OUTPUT_DATE%
rem pause
if "%RESX_DATE%" gtr "%OUTPUT_DATE%" (
echo Resource file has changed, regenerating output files...
"%1" "%2" "%3" "%4" "%5"
) else (
echo Resource file is unchanged, skipping regeneration.
)