diff --git a/link-to-ooo-home b/link-to-ooo-home index a477fdd..cc2f4bd 100644 --- a/link-to-ooo-home +++ b/link-to-ooo-home @@ -19,10 +19,19 @@ change_linking() { # if we get ourselves folder then just create it # it might not be around so lets be safe if [[ -d "${file}" ]] ; then - mkdir -p "${dir/${datadir}/${libdir}}" + dirname="${dir/${datadir}/${libdir}}" + # if the location is already there skip it + if [[ ! -e "${dirname}" ]]; then + mkdir -p "${dirname}" + fi continue fi - ln -sf "${file}" "${file/${datadir}/${libdir}}" || exit 1 + linkfile="${file/${datadir}/${libdir}}" + # if the file is already there, skip it + # this is true when the parent folder is link + if [[ ! -e "${linfile}" ]]; then + ln -sf "${file}" "${linfile}" || exit 1 + fi done else # first just remove the symlinks