-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_builder.cmd
87 lines (59 loc) · 1.83 KB
/
_builder.cmd
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
74
75
76
77
78
79
80
81
82
83
84
85
86
@echo off
::force UTF-8 support
::chcp 65001 2>nul >nul
::----------------------------------------------------::
:: make sure to browse the path to your `node.exe`, ::
:: show properties, under compatibilities set "ON" ::
:: the checkbox for run as admin. ::
::----------------------------------------------------::
set _NODE=C:\nodejs\node.exe
::relative path
set _PATH=%~dp0
set _SCPT=_builder.js
set __BLD=build
::to explicit path (long)
set _SCPT="%_PATH%%_SCPT%"
set __BLD="%_PATH%%__BLD%"
::to explicit short path (8.3)
for /f %%a in ("%_NODE%")do (set "_NODE=%%~fsa" )
for /f %%a in ("%_SCPT%")do (set "_SCPT=%%~fsa" )
for /f %%a in ("%__BLD%")do (set "__BLD=%%~fsa" )
::cleanup old build folder.
del /q /s /f "%__BLD%" 1>nul 2>nul
del /q /s /f "%__BLD%\" 1>nul 2>nul
del /q /s /f /a:rhisal "%__BLD%\*" 1>nul 2>nul
rmdir /q /s "%__BLD%" 1>nul 2>nul
rmdir /q /s "%__BLD%\" 1>nul 2>nul
echo.
echo DEBUG: cleanup old build folder.
if exist %__BLD% goto BUILD_NOCLEAN
if exist %__BLD%\NUL goto BUILD_NOCLEAN
echo DONE.
::create new empty build folder.
mkdir "%__BLD%" 2>nul >nul
echo.
echo DEBUG: create new empty build folder.
if not exist %__BLD% goto BUILD_NOCREATE
if not exist %__BLD%\NUL goto BUILD_NOCREATE
echo DONE.
echo.
echo DEBUG: running main script ^("%_SCPT%"^) with NodeJS ^("%_NODE%"^).
echo.
call "%_NODE%" "%_SCPT%"
echo.
echo DONE.
echo.
echo DEBUG: all done.
goto EXIT
::------------------------------------------------
:BUILD_NOCLEAN
echo.
echo ERROR: could not delete the "%__BLD%" folder, maybe it is used by another program, try run again.
goto EXIT
:BUILD_NOCREATE
echo.
echo ERROR: could not create the "%__BLD%" folder, try run again.
goto EXIT
:EXIT
echo.
pause