55 local _class_0
66 local _parent_0 = Platform
77 local _base_0 = {
8- validate = function (self ) end ,
8+ validate = function (self )
9+ return assert (io .fileExists (self .clientPath , false ), ' The path to the Blizzard Battle.net client is undefined or invalid.' )
10+ end ,
911 hasUnprocessedPaths = function (self )
1012 return # self .battlenetPaths > 0
1113 end ,
4042 if ' destiny 2' == _exp_0 then
4143 args = {
4244 title = ' Destiny 2' ,
43- path = ' battlenet:// DST2' ,
45+ path = ' DST2' ,
4446 process = ' destiny2.exe'
4547 }
4648 elseif ' diablo iii' == _exp_0 then
4749 args = {
4850 title = ' Diablo III' ,
49- path = ' battlenet:// D3' ,
51+ path = ' D3' ,
5052 process = (function ()
5153 if bits == 64 then
5254 return ' Diablo III64.exe'
5860 elseif ' hearthstone' == _exp_0 then
5961 args = {
6062 title = ' Hearthstone' ,
61- path = ' battlenet:// WTCG' ,
63+ path = ' WTCG' ,
6264 process = ' Hearthstone.exe'
6365 }
6466 elseif ' heroes of the storm' == _exp_0 then
6567 args = {
6668 title = ' Heroes of the Storm' ,
67- path = ' battlenet:// Hero' ,
69+ path = ' Hero' ,
6870 process = (function ()
6971 if bits == 64 then
7072 return ' HeroesOfTheStorm_x64.exe'
7678 elseif ' overwatch' == _exp_0 then
7779 args = {
7880 title = ' Overwatch' ,
79- path = ' battlenet:// Pro' ,
81+ path = ' Pro' ,
8082 process = ' Overwatch.exe'
8183 }
8284 elseif ' starcraft' == _exp_0 then
8385 args = {
8486 title = ' StarCraft' ,
85- path = ' battlenet:// S1' ,
87+ path = ' S1' ,
8688 process = ' StarCraft.exe'
8789 }
8890 elseif ' starcraft ii' == _exp_0 then
8991 args = {
9092 title = ' StarCraft II' ,
91- path = ' battlenet:// S2' ,
93+ path = ' S2' ,
9294 process = (function ()
9395 if bits == 64 then
9496 return ' SC2_x64.exe'
100102 elseif ' world of warcraft' == _exp_0 then
101103 args = {
102104 title = ' World of Warcraft' ,
103- path = ' battlenet:// WoW' ,
105+ path = ' WoW' ,
104106 process = (function ()
105107 if bits == 64 then
106108 return ' Wow-64.exe'
122124 _continue_0 = true
123125 break
124126 end
127+ args .path = (' "%s" --exec="launch %s"' ):format (self .clientPath , args .path )
125128 args .banner = self :getBannerPath (args .title )
126129 if not (args .banner ) then
127130 args .expectedBanner = args .title
160163 end
161164 return _accum_0
162165 end )() or { }
166+ self .clientPath = io .joinPaths (settings :getBattlenetClientPath (), ' Battle.net.exe' )
163167 self .enabled = settings :getBattlenetEnabled ()
164168 self .games = { }
165169 end ,
@@ -201,6 +205,9 @@ if RUN_TESTS then
201205 end ,
202206 getBattlenetEnabled = function (self )
203207 return true
208+ end ,
209+ getBattlenetClientPath = function (self )
210+ return ' C:\\ Program Files\\ Battle.net'
204211 end
205212 }
206213 local battlenet = Battlenet (settings )
@@ -215,47 +222,47 @@ if RUN_TESTS then
215222 local expectedGames = {
216223 {
217224 title = ' Diablo III' ,
218- path = ' battlenet://D3 ' ,
225+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch D3" ' ,
219226 process = ' Diablo III64.exe'
220227 },
221228 {
222229 title = ' StarCraft' ,
223- path = ' battlenet://S1 ' ,
230+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch S1" ' ,
224231 process = ' StarCraft.exe'
225232 },
226233 {
227234 title = ' Overwatch' ,
228- path = ' battlenet:// Pro' ,
235+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch Pro" ' ,
229236 process = ' Overwatch.exe'
230237 },
231238 {
232239 title = ' Hearthstone' ,
233- path = ' battlenet:// WTCG' ,
240+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch WTCG" ' ,
234241 process = ' Hearthstone.exe'
235242 },
236243 {
237244 title = ' Heroes of the Storm' ,
238- path = ' battlenet:// Hero' ,
245+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch Hero" ' ,
239246 process = ' HeroesOfTheStorm.exe'
240247 },
241248 {
242249 title = ' StarCraft II' ,
243- path = ' battlenet://S2 ' ,
250+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch S2" ' ,
244251 process = ' SC2.exe'
245252 },
246253 {
247254 title = ' StarCraft' ,
248- path = ' battlenet://S1 ' ,
255+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch S1" ' ,
249256 process = ' StarCraft.exe'
250257 },
251258 {
252259 title = ' World of Warcraft' ,
253- path = ' battlenet:// WoW' ,
260+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch WoW" ' ,
254261 process = ' Wow.exe'
255262 },
256263 {
257264 title = ' Destiny 2' ,
258- path = ' battlenet:// DST2' ,
265+ path = ' "C: \\ Program Files \\ Battle.net \\ Battle.net.exe" --exec="launch DST2" ' ,
259266 process = ' destiny2.exe'
260267 }
261268 }
0 commit comments