Cotton code
15 lines · 651 B · ShellRaw
#!/usr/bin/env bash# cotton:real-data-root — the one refusal every walk and copy script asks, so# no other script spells the real data folder.##   refuse_real_data_root <script name> <path>## Exits 2 with a sentence when <path> is the owner's real data folder, the dev# app's folder or the Mac app's support folder, or anything inside them.# Sourced, never run.refuse_real_data_root() {  local who="$1" path="${2%/}" real  for real in "$HOME/CottonDB" "$HOME/CottonDev" "$HOME/Library/Application Support/CottonDB"; do    case "$path/" in "$real"/*) echo "$who: $path is inside $real; name a scratch folder" >&2; exit 2 ;; esac  done}