diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-01-08 23:55:02 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2008-01-08 23:55:02 +0000 |
commit | 9efc8450ed3a65bd5216972c013be620444d3d50 (patch) | |
tree | 5bda656e7e5f9a95dc0d73320b7b22584d8e10ef /nuttx/tools/winlink.sh | |
parent | bfeb1e08dd6726d78ae23a5dd01109f1fb6d5f82 (diff) | |
download | px4-nuttx-9efc8450ed3a65bd5216972c013be620444d3d50.tar.gz px4-nuttx-9efc8450ed3a65bd5216972c013be620444d3d50.tar.bz2 px4-nuttx-9efc8450ed3a65bd5216972c013be620444d3d50.zip |
Need to handle paths with spaces in them
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@532 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/tools/winlink.sh')
-rwxr-xr-x | nuttx/tools/winlink.sh | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/nuttx/tools/winlink.sh b/nuttx/tools/winlink.sh index c98efa47d..272fb9636 100755 --- a/nuttx/tools/winlink.sh +++ b/nuttx/tools/winlink.sh @@ -55,23 +55,25 @@ if [ -z "${src}" -o -z "${dest}" ]; then exit 1 fi -# Check if something already exists at the destination path +# Check if something already exists at the destination path replace it with +# the new link (which might be different). Note that we check for the +# the link (-h) before we check for existence (-e) because a bad link will +# report that it does not exist. -if [ -e "${dest}" ]; then +if [ -h "${dest}" ]; then + rm -f "${dest}" +else - # Yes, is it a symbolic link? If so, then remove it so that we can - # replace it with the new directory copy + # If the path exists and is a directory that contains the "fake link" + # mark, then treat it like a soft link (i.e., remove the directory) - if [ -h "${dest}" ]; then - rm -f "${dest}" + if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then + rm -rf "${dest}" else - # If the path is a directory and contains the "fake link" mark, then - # remove the directory so that we can replace it with a new copy + # Does anything exist at the destination path? - if [ -d "${dest}" -a -f "${dest}/.fakelnk" ]; then - rm -rf "${dest}" - else + if [ -e "${dest}" ]; then # It is something else (like a file) or directory that does # not contain the "fake link" mark @@ -82,9 +84,10 @@ if [ -e "${dest}" ]; then fi fi + # Verify that a directory exists at the source path -if [ ! -d ${src} ]; then +if [ ! -d "${src}" ]; then echo "No directory at ${src}" exit 1 fi |