## Rename user-profile.* user_profile.* to resolve #1806, #1675

* This is a backward compatible fix and will automatically and silently rename users '%cmder_root%/config/user-profile.\*' to '%cmder_root%/config/user_profile.\*' and '[user_specified_config_root]/user-profile.\*' to '[user_specified_config_root]/user_profile.\*' if the sources exist.

  * Cmder.exe does this for cmd.exe sessions.
  * The init scripts for bash and Powershell handles it for these shells
This commit is contained in:
Dax T Games
2018-08-31 17:02:56 -05:00
committed by Benjamin Staneck
parent e4fb0d694b
commit 49da3745bc
7 changed files with 120 additions and 58 deletions

31
vendor/cmder.sh vendored
View File

@ -1,6 +1,6 @@
# DO NOT EDIT THIS FILE IT WILL BE OVERWRITTEN ON UPDATE
#
# Add portable user customizations ${CMDER_ROOT}/config/user-profile.sh,
# Add portable user customizations ${CMDER_ROOT}/config/user_profile.sh,
# these customizations will follow Cmder if $CMDER_ROOT is copied
# to another machine.
#
@ -63,21 +63,32 @@ if [ -d "${CMDER_USER_CONFIG}/profile.d" ] ; then
runProfiled "${CMDER_USER_CONFIG}/profile.d"
fi
initialConfig="${CMDER_ROOT}/config/user-profile.sh"
if [ -f "${CMDER_ROOT}/config/user-profile.sh" ] ; then
. "${CMDER_ROOT}/config/user-profile.sh"
# Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency.
if [ -f "$CMDER_ROOT/config/user-profile.sh" ] ; then
mv "$CMDER_ROOT/config/user-profile.sh" "$CMDER_ROOT/config/user_profile.sh"
fi
CmderUserProfilePath="${CMDER_ROOT}/config/user_profile.sh"
if [ -f "${CMDER_ROOT}/config/user_profile.sh" ] ; then
. "${CMDER_ROOT}/config/user_profile.sh"
fi
if [ "${CMDER_USER_CONFIG}" != "" ] ; then
initialConfig="${CMDER_USER_CONFIG}/user-profile.sh"
if [ -f "${CMDER_USER_CONFIG}/user-profile.sh" ] ; then
. "${CMDER_USER_CONFIG}/user-profile.sh"
# Renaming to "config\user_profile.sh" to "user_profile.sh" for consistency.
if [ -f "$CMDER_USER_CONFIG/user-profile.sh" ] ; then
mv "$CMDER_USER_CONFIG/user-profile.sh" "$CMDER_USER_CONFIG/user_profile.sh"
fi
CmderUserProfilePath="${CMDER_USER_CONFIG}/user_profile.sh"
if [ -f "${CMDER_USER_CONFIG}/user_profile.sh" ] ; then
. "${CMDER_USER_CONFIG}/user_profile.sh"
fi
fi
if [ ! -f "${initialConfig}" ] ; then
echo Creating user startup file: "${initialConfig}"
cat <<-eof >"${initialConfig}"
if [ ! -f "${CmderUserProfilePath}" ] ; then
echo Creating user startup file: "${CmderUserProfilePath}"
cat <<-eof >"${CmderUserProfilePath}"
# use this file to run your own startup commands for msys2 bash'
# To add a new vendor to the path, do something like: