Created
February 17, 2016 06:24
-
-
Save larryhou/db121a90899519e6319b to your computer and use it in GitHub Desktop.
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 | |
cd ${1} | |
function get_paths() | |
{ | |
cat <<-PATH | |
D:/Program Files (x86)/Unity4.6.8/Editor/Data/Managed/UnityEngine.dll | |
D:/Program Files (x86)/Unity4.6.8/Editor/Data/Managed/UnityEditor.dll | |
D:/Program Files (x86)/Unity4.6.8/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.8/Standalone/UnityEngine.UI.dll | |
D:/Program Files (x86)/Unity4.6.8/Editor/Data/UnityExtensions/Unity/GUISystem/4.6.8/Editor/UnityEditor.UI.dll | |
D:/Program Files (x86)/Unity4.6.8/Editor/Data/Managed/UnityEditor.Graphs.dll | |
/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll | |
/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.dll | |
/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/Editor/UnityEditor.UI.dll | |
/Applications/Unity/Unity.app/Contents/UnityExtensions/Unity/GUISystem/Standalone/UnityEngine.UI.dll | |
/Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEditor.Graphs.dll | |
PATH | |
} | |
function get_csproj() | |
{ | |
grep -Hr --include '*.csproj' ':\/Program Files' . | awk -F':' '{print $1}' | sort | uniq | |
} | |
function replace_path() | |
{ | |
let num=0 | |
while read line | |
do | |
value=$(echo ${line} | sed 's/\//\\\//g' | sed 's/ /\\ /g') | |
let num=num+1 | |
if [ ${num} -eq 1 ] | |
then | |
src=${value} | |
else | |
dst=${value} | |
get_csproj | xargs -I{} sed -i '' "s/${src}/${dst}/g" {} | |
fi | |
done < <(get_paths | grep "${1}$") | |
} | |
get_paths | awk -F'/' '{print $NF}' | sed 's/ //g' | sed '/^$/d' | sort | uniq | while read dll | |
do | |
replace_path ${dll} | |
done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment