Make mkcontrollers script work when building as a submodule
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
rootdir=$1
|
||||||
|
|
||||||
curl https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt | grep -v '^#' | grep -v '^$' | sed s/',$'//g > mappings.txt
|
curl https://raw.githubusercontent.com/mdqinc/SDL_GameControllerDB/refs/heads/master/gamecontrollerdb.txt | grep -v '^#' | grep -v '^$' | sed s/',$'//g > mappings.txt
|
||||||
|
|
||||||
filelen=$(wc -l mappings.txt | cut -d ' ' -f 1)
|
filelen=$(wc -l mappings.txt | cut -d ' ' -f 1)
|
||||||
|
|
||||||
cat > ../include/akgl/SDL_GameControllerDB.h <<EOF
|
cat > ${rootdir}/include/akgl/SDL_GameControllerDB.h <<EOF
|
||||||
#ifndef _SDL_GAMECONTROLLERDB_H_
|
#ifndef _SDL_GAMECONTROLLERDB_H_
|
||||||
#define _SDL_GAMECONTROLLERDB_H_
|
#define _SDL_GAMECONTROLLERDB_H_
|
||||||
|
|
||||||
@@ -20,11 +22,11 @@ counter=0
|
|||||||
cat mappings.txt | while read LINE;
|
cat mappings.txt | while read LINE;
|
||||||
do
|
do
|
||||||
if [[ $counter -gt 0 ]]; then
|
if [[ $counter -gt 0 ]]; then
|
||||||
printf ",\n" >> ../include/akgl/SDL_GameControllerDB.h;
|
printf ",\n" >> ${rootdir}/include/akgl/SDL_GameControllerDB.h;
|
||||||
fi
|
fi
|
||||||
printf " \"${LINE}\"" >> ../include/akgl/SDL_GameControllerDB.h;
|
printf " \"${LINE}\"" >> ${rootdir}/include/akgl/SDL_GameControllerDB.h;
|
||||||
counter=$((counter + 1))
|
counter=$((counter + 1))
|
||||||
done
|
done
|
||||||
|
|
||||||
printf "\n};\n" >> ../include/akgl/SDL_GameControllerDB.h
|
printf "\n};\n" >> ${rootdir}/include/akgl/SDL_GameControllerDB.h
|
||||||
printf "#endif // _SDL_GAMECONTROLLERDB_H_\n" >> ../include/akgl/SDL_GameControllerDB.h
|
printf "#endif // _SDL_GAMECONTROLLERDB_H_\n" >> ${rootdir}/include/akgl/SDL_GameControllerDB.h
|
||||||
|
|||||||
Reference in New Issue
Block a user