diff --git a/script_helpers/file_ops.sh b/script_helpers/file_ops.sh index 776ffd4..abe9326 100644 --- a/script_helpers/file_ops.sh +++ b/script_helpers/file_ops.sh @@ -219,7 +219,7 @@ link_file() { eval $link_cmd 1>/dev/null } -function setup_file() { +setup_file() { src=$1 dest=$2 if [ ! -f $dest ]; then @@ -229,13 +229,14 @@ function setup_file() { fi } -function setup_dir() { +setup_dir() { src=$1 dest=$2 - ignore_missing=$3 + abort_if_src_not_found=$3 + if [ ! -d $src ]; then error "Source path '$src' doesn't exist!\n" - if [[ $ignore_missing != "1" ]]; then + if [[ $abort_if_src_not_found != "1" ]]; then abort else return @@ -248,3 +249,13 @@ function setup_dir() { fi } +create_dir() { + path=$1 + if [ -d $path ]; then + printf "${BOLD}${MAGENTA}==> ${NORMAL}${BOLD}${YELLOW}'$path'${NORMAL} already exists${NORMAL}\n" + return + fi + mkdir $path + printf "${BOLD}${GREEN}==> ${NORMAL}Created ${BOLD}${YELLOW}'$path'${NORMAL}\n" +} +