--- /dev/null
+# Find a path, preferring the target user's version.
+function find_target_profile() {
+ local path="$1"; shift
+
+ for dir in $HOME $PROFILE_HOME; do
+ if [ -e "$dir/$path" ]; then
+ echo "$dir/$path"
+ break
+ fi
+ done
+
+ unset dir
+}
+
+# Find a path, preferring the source user's version.
+function find_source_profile() {
+ local path="$1"; shift
+
+ for dir in $PROFILE_HOME $HOME; do
+ if [ -e "$dir/$path" ]; then
+ echo "$dir/$path"
+ break
+ fi
+ done
+
+ unset dir
+}