fix(build): Handle empty list of bat/adp names

This commit is contained in:
Michael Carlberg 2016-11-12 15:03:45 +01:00
parent d02e2a47fb
commit fe1d0579ec
1 changed files with 11 additions and 2 deletions

View File

@ -33,8 +33,17 @@ string(REGEX REPLACE /%adapter%.* "" PATH_ADP ${SETTING_PATH_ADAPTER_STATUS})
file(GLOB BAT_LIST RELATIVE ${PATH_BAT} ${PATH_ADP}/B*)
file(GLOB ADP_LIST RELATIVE ${PATH_ADP} ${PATH_ADP}/A*)
list(GET BAT_LIST 0 BATTERY)
list(GET ADP_LIST 0 ADAPTER)
if(BAT_LIST)
list(GET BAT_LIST 0 BATTERY)
else()
set(BATTERY BAT0)
endif()
if(ADP_LIST)
list(GET ADP_LIST 0 ADAPTER)
else()
set(ADAPTER ADP1)
endif()
# }}}
# Configure and install {{{