Commit 36e94a25 authored by Thomas Schöpping's avatar Thomas Schöpping
Browse files

The QtCreator script will now create new directories for project files if required.

parent 40856bdc
......@@ -83,15 +83,24 @@ function printHelp {
### read directory where to create/delete projects #############################
# Read the directory where to create/delete project files from user.
#
# usage: getProjectDir <pathvar>
# usage: getProjectDir <pathvar> [<initpath>]
# arguments: <pathvar>
# Variable to store the selected path to.
# <inipath>
# Optional initial path to suggest the user.
# If not set, the AMiRo-BLT Target/ directory is suggested.
# return: n/a
#
function getProjectDir {
printLog "reading path for project files from user...\n"
local amirobltdir=$(realpath $(dirname $(realpath ${BASH_SOURCE[0]}))/../../../Target/)
local amirobltdir="$2"
local input=""
# if no initial path was given, default to AMiRo-BLT Target/ directory
if [ -z "$amirobltdir" ]; then
amirobltdir=$(realpath $(dirname $(realpath ${BASH_SOURCE[0]}))/../../../Target/)
fi
printLog "reading path for project files from user...\n"
read -p "Path where to create/delete project files: " -i $amirobltdir -e input
printLog "user selected path $(realpath $input)\n"
eval $1="$(realpath $input)"
......@@ -111,9 +120,10 @@ function getProjectDir {
# Error: include directory could not be resolved.
#
function retrieveGccIncludeDir {
# retrieve binary path or link
local binpath=$(which arm-none-eabi-gcc)
local gccincpath=""
# retrieve binary path or link
if [ -z "$binpath" ]; then
printError "command 'arm-none-eabi-gcc' not found\n"
return -1
......@@ -288,9 +298,14 @@ function createModuleProject {
# read absolute project directory if required
if [ -z "$projectdir" ]; then
getProjectDir projectdir
getProjectDir projectdir $(realpath $(dirname $(realpath ${BASH_SOURCE[0]}))/../../../Target/qtcreator/)
printf "\n"
fi
# check whether the directoty exists and create it if required
if [ ! -d "$projectdir" ]; then
printWarning "Creating nonexistent directory '$projectdir'.\n"
mkdir -p "$projectdir"
fi
# check for existing project files
local projectfiles="$(find ${projectdir} -maxdepth 1 -type f | grep -E "${module}\.(includes|files|config|creator)$")"
......@@ -488,7 +503,12 @@ function createAllProjects {
# read absolute project directory if required
if [ -z "$projectsdir" ]; then
getProjectDir projectsdir
getProjectDir projectsdir $(realpath $(dirname $(realpath ${BASH_SOURCE[0]}))/../../../Target/qtcreator/)
fi
# check whether the directoty exists and create it if required
if [ ! -d "$projectdir" ]; then
printWarning "Creating nonexistent directory '$projectdir'.\n"
mkdir -p "$projectdir"
fi
# check for existing project files
......@@ -594,9 +614,13 @@ function deleteProjects {
done
# read absolute project directory if required
if [ -z "$projectdir" ]; then
getProjectDir projectdir
fi
while [ -z "$projectdir" ]; do
getProjectDir projectdir $(realpath $(dirname $(realpath ${BASH_SOURCE[0]}))/../../../Target/qtcreator/)
if [ ! -d "$projectdir" ]; then
printWarning "directory does not exist.\n"
projectdir=""
fi
done
# list all files to be deleted
if [ -z "$modulename" ]; then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment