aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/.bashrc_third_party
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2016-07-13 22:06:01 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2016-07-13 22:06:01 +0300
commit5e2ebda430569624c5f34115ca8e45a1633dd3cf (patch)
treec050162fa4913dde4ab3cad8f0ed1a99b8dea178 /.bashrc_third_party
parentadd ensure_symlinks_enabled (diff)
downloadlinux-home-5e2ebda430569624c5f34115ca8e45a1633dd3cf.tar.gz
linux-home-5e2ebda430569624c5f34115ca8e45a1633dd3cf.zip
split .bashrc into multiple files
Diffstat (limited to '.bashrc_third_party')
-rw-r--r--.bashrc_third_party41
1 files changed, 41 insertions, 0 deletions
diff --git a/.bashrc_third_party b/.bashrc_third_party
new file mode 100644
index 0000000..be33720
--- /dev/null
+++ b/.bashrc_third_party
@@ -0,0 +1,41 @@
+ensure_symlinks_enabled() {
+ [ -z "${CYGWIN+x}" ] && return 1
+
+ case "$CYGWIN" in
+ *winsymlinks:native*) ;;
+ *winsymlinks:nativestrict*) ;;
+
+ *)
+ return 1
+ ;;
+ esac
+}
+
+symlink_preferences() (
+ if ! ensure_symlinks_enabled; then
+ echo "$FUNCNAME: it seems like native Windows symlinks aren't enabled in Cygwin." >&2
+ return 1
+ fi
+
+ set -o errexit
+
+ if [ "$#" -ne 2 ]; then
+ echo "$FUNCNAME: usage: $FUNCNAME SRC_DIR DEST_DIR" >&2
+ return 1
+ fi
+
+ local src_dir="$1"
+ local dest_dir="$2"
+
+ [ -d "$dest_dir" ] || mkdir -p "$dest_dir"
+
+ find "$src_dir" -maxdepth 1 -type f -exec ln --force -s {} "$dest_dir" \;
+)
+
+symlink_sublime_preferences() {
+ symlink_preferences "$HOME/.Sublime Text 3" "$APPDATA/Sublime Text 3/Packages/User"
+}
+
+symlink_ghc_preferences() {
+ symlink_preferences "$HOME/.GHC" "$APPDATA/ghc"
+}