forked from fdorg/flashdevelop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallHaxeFlixel.cmd
More file actions
146 lines (94 loc) · 2.89 KB
/
Copy pathInstallHaxeFlixel.cmd
File metadata and controls
146 lines (94 loc) · 2.89 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
@echo off
:: Script for installing HaxeFlixel and it's dependencies.
:: Path refresh adapted from: https://github.com/chocolatey/chocolatey/blob/master/src/redirects/RefreshEnv.cmd
:: Skip PATH refresh on Wine/CrossOver
if "%WINEPREFIX%"=="" (goto :refresh_path) else (goto :check_haxelib)
:setfromreg
"%WinDir%\System32\Reg" QUERY "%~1" /v "%~2" > "%TEMP%\_envset.tmp" 2>NUL
for /f "usebackq skip=2 tokens=2,*" %%A IN ("%TEMP%\_envset.tmp") do (
echo/set %~3=%%B
)
goto :EOF
:getregenv
"%WinDir%\System32\Reg" QUERY "%~1" > "%TEMP%\_envget.tmp"
for /f "usebackq skip=2" %%A IN ("%TEMP%\_envget.tmp") do (
if /I not "%%~A"=="Path" (
call :setfromreg "%~1" "%%~A" "%%~A"
)
)
goto :EOF
:refresh_path
echo Refreshing PATH from registry...
echo/@echo off >"%TEMP%\_env.cmd"
:: Slowly generating final file
call :getregenv "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" >> "%TEMP%\_env.cmd"
call :getregenv "HKCU\Environment">>"%TEMP%\_env.cmd" >> "%TEMP%\_env.cmd"
:: Special handling for PATH - mix both User and System
call :setfromreg "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" Path Path_HKLM >> "%TEMP%\_env.cmd"
call :setfromreg "HKCU\Environment" Path Path_HKCU >> "%TEMP%\_env.cmd"
:: Caution: do not insert space-chars before >> redirection sign
echo/set Path=%%Path_HKLM%%;%%Path_HKCU%% >> "%TEMP%\_env.cmd"
:: Cleanup
del /f /q "%TEMP%\_envset.tmp" 2>nul
del /f /q "%TEMP%\_envget.tmp" 2>nul
:: Set these variables
call "%TEMP%\_env.cmd"
echo OK
goto :check_haxelib
:check_haxelib
echo Checking Haxelib...
haxelib help > nul
:: Check for errors
if %errorlevel% neq 0 goto :haxelib_error
echo OK
goto :check_openfl
:check_openfl
echo Checking OpenFL...
haxelib path openfl > nul
:: Check for errors
if %errorlevel% neq 0 goto :install_openfl
echo OK
goto :check_flixel
:install_openfl
echo Installing OpenFL...
haxelib install openfl
haxelib run openfl setup
:: Check for errors
if %errorlevel% neq 0 goto :install_error
goto :options_vs
:options_vs
set /p option="Also install free Visual Studio for C++ Windows applications? [y/n] "
if "%option%" == "y" goto :install_vs
if "%option%" == "n" goto :check_flixel
echo Invalid value, try again.
goto :options_vs
:install_vs
lime setup windows
:: Check for errors
if %errorlevel% neq 0 goto :install_error
goto :check_flixel
:check_flixel
echo Checking HaxeFlixel...
haxelib path flixel > nul
:: Check for errors
if %errorlevel% neq 0 goto :install_flixel
echo OK
goto :done
:install_flixel
echo Installing HaxeFlixel...
haxelib install flixel
:: Check for errors
if %errorlevel% neq 0 goto :install_error
goto :done
:haxelib_error
echo Haxe seems not to be installed. Please install Haxe first or if it's installed, restart Windows before continuing.
pause
exit -1
:install_error
echo Could not install the requested tools.
pause
exit -1
:done
echo OpenFL + HaxeFlixel installed successfully.
pause
exit 0