Created
April 16, 2010 18:48
-
-
Save timabell/368789 to your computer and use it in GitHub Desktop.
strip non-existent files from monodevelop project file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#strip non-existent files from monodevelop project file | |
projectFile=$1 #first arg should be the .mdp file to process | |
if [ "$1" == "" ] | |
then | |
echo "usage: $0 project.mdp" | |
exit 1 | |
fi | |
#set IFS to allow processing of files with spaces. | |
#ref http://tldp.org/LDP/abs/html/internalvariables.html | |
# http://www.cyberciti.biz/tips/handling-filenames-with-spaces-in-bash.html | |
IFS=$(echo -en "\n\b") | |
for f in `grep '<File' "$projectFile" | perl -pe 's|.*name="(.*?)".*|\1|'` | |
do | |
if [ ! -e "$f" ] | |
then | |
echo "'$f' doesn't exist, removing from project..." | |
escapedFile=`echo $f | sed -e 's/\//\\\\\//g'` | |
sed -i "/$escapedFile/d" $projectFile | |
fi | |
done | |
echo "done." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment