use a QTCreator environmentid and a profileid from a local installation
When creating QTCreator project files use local EnvironmentId and default profile id. By default the environment id is stored in ~/.config/QtProject/QtCreator.ini and the profile id in ~/.config/QtProject/qtcreator/profiles.xml.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
<value type="QByteArray">{5ab9881c-fa5d-4482-9095-89b8f4d69c9e}</value>
|
||||
<value type="QByteArray">%%%QT_ENVIRONMENT_ID%%%</value>
|
||||
</data>
|
||||
<data>
|
||||
<variable>ProjectExplorer.Project.ActiveTarget</variable>
|
||||
@@ -93,7 +93,7 @@
|
||||
<value type="QString" key="DeviceType">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{d8d7580a-b779-40c7-980c-a52adf87b0ab}</value>
|
||||
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">%%%QT_DEFAULT_PROFILE_ID%%%</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
|
||||
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
|
||||
|
@@ -12,6 +12,39 @@ if [ ! -d ${CURRENT_DIR}/.templates ] ; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
qtcreatorini=~/.config/QtProject/QtCreator.ini
|
||||
qtprofiles=~/.config/QtProject/qtcreator/profiles.xml
|
||||
|
||||
if [ ! -f "$qtcreatorini" ] ; then
|
||||
echo "I cannot find a $qtcreatorini file"
|
||||
echo "this file is needed to take an EnvironmentId parameter"
|
||||
echo "if QTCreator was recently installed make sure you have opened it at least once"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [ ! -f "$qtprofiles" ] ; then
|
||||
echo "I cannot find a $qtprofiles file"
|
||||
echo "this file is needed to take a default profile id parameter"
|
||||
echo "if QTCreator was recently installed make sure you have opened it at least once"
|
||||
exit 3
|
||||
fi
|
||||
|
||||
qtenvironmentid=`grep -F 'Settings\EnvironmentId' "$qtcreatorini" | grep -Eo '\{[a-zA-Z0-9-]+\}'`
|
||||
qtdefaultprofileid=`grep -A 1 -F '<variable>Profile.Default</variable>' "$qtprofiles" | tail -n 1 | grep -Eo '\{[a-zA-Z0-9-]+\}'`
|
||||
|
||||
if [ -z "$qtenvironmentid" ] ; then
|
||||
echo "I cannot read a Settings\EnvironmentId parameter from $qtcreatorini file"
|
||||
exit 4
|
||||
fi
|
||||
|
||||
if [ -z "$qtdefaultprofileid" ] ; then
|
||||
echo "I cannot read a Profile.Default parameter from $qtprofiles file"
|
||||
exit 5
|
||||
fi
|
||||
|
||||
echo "Your QTCreator EnvironmentId is: $qtenvironmentid"
|
||||
echo "Your QTCreator default profile id is: $qtdefaultprofileid"
|
||||
|
||||
# change / to \/ in paths
|
||||
CURRENT_DIR_FOR_SED=$(echo ${CURRENT_DIR} | sed 's/\//\\\//g')
|
||||
GLOBAL_WORKING_DIR_FOR_SED=$(echo ${GLOBAL_WORKING_DIR} | sed 's/\//\\\//g')
|
||||
@@ -35,7 +68,9 @@ if [ -d "${QTCREATOR_DIR}" ] ; then
|
||||
if [ ! -f "${QTCREATOR_DIR}/$i" ] ; then
|
||||
cat "$i" | \
|
||||
sed -e "s/%%%CURRENT_DIR%%%/${CURRENT_DIR_FOR_SED}/g" \
|
||||
-e "s/%%%GLOBAL_WORKING_DIR%%%/${GLOBAL_WORKING_DIR_FOR_SED}/g" > \
|
||||
-e "s/%%%GLOBAL_WORKING_DIR%%%/${GLOBAL_WORKING_DIR_FOR_SED}/g" \
|
||||
-e "s/%%%QT_ENVIRONMENT_ID%%%/${qtenvironmentid}/g" \
|
||||
-e "s/%%%QT_DEFAULT_PROFILE_ID%%%/${qtdefaultprofileid}/g" > \
|
||||
"${QTCREATOR_DIR}/$i"
|
||||
fi
|
||||
done
|
||||
|
Reference in New Issue
Block a user