Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Check for existence of project file
- if [ -e $1.files ]
- then
- printf "Updating '%s' project...\n" $1
- project=$1
- shift
- else
- printf "Error: Project file '%s' not found!\n" $1.files
- exit 1
- fi
- # Save copy of old one before updating
- cp -f $project.files $project.files.old
- # Grab the files that are listed before the first empty line, leaving them untouched
- sed $project.files -r -e '/^\s*$/q' > $project.files.new
- # Re-insert the empty line between non-auto files and the rest
- echo >> $project.files.new
- #
- # Grab all files listed in all dependency files in all specified sub-directories
- #
- until [ -z "$1" ] # Until all parameters used up . . .
- do
- # Check for existence of dependencies dir
- if [ -d $1/dep ]
- then
- depdir=$1/dep
- else
- depdir=$1
- fi
- printf "Scanning for dependencies in '%s'...\n" $depdir
- ls $depdir/*.d > /dev/null 2> /dev/null
- result=$?
- if [ $result -ne 0 ]
- then
- printf "Error (%d): No dependency files found in '%s'!\n" $result $depdir
- exit 1
- fi
- # Grab all files listed in all dependency files in all possibly-matching sub-directories
- sed -nr -f $0.sed $depdir/*.d | \
- # Sort and filter for uniques before dumping them
- sort | uniq >> $project.files.new
- shift
- done
- # Check whether file lists differ
- if ! diff -q $project.files $project.files.new
- then
- # Copy new file list over old and warn user that they need to re-open the project
- echo "Warning: Qt Creator file list has been updated. Project should be re-opened."
- mv -f $project.files.new $project.files
- else
- # Just get rid of the temp file
- rm -f $project.files.new
- fi
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement