File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed
Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -30,9 +30,15 @@ run_profile_d() {
3030# Converts Windows paths to Unix paths if needed
3131# ConEmuDir is set by ConEmu/Cmder environment
3232if [ -z " $CMDER_ROOT " ]; then
33+ # Try to get CMDER_ROOT from ConEmuDir
3334 case " $ConEmuDir " in
3435 * \\ * ) CMDER_ROOT=$( cd " $( cygpath -u " $ConEmuDir " ) /../.." && pwd ) ;;
3536 esac
37+
38+ # If still not set, derive from script location (vendor -> root)
39+ if [ -z " $CMDER_ROOT " ]; then
40+ CMDER_ROOT=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) /.." && pwd ) "
41+ fi
3642else
3743 case " $CMDER_ROOT " in
3844 * \\ * ) CMDER_ROOT=" $( cygpath -u " $CMDER_ROOT " ) " ;;
Original file line number Diff line number Diff line change @@ -67,6 +67,21 @@ elif [ -n "$CMDER_ROOT" ]; then
6767 esac
6868fi
6969
70+ # If CMDER_ROOT is still not set, try to derive from script location
71+ # Note: This only works if cmder_exinit is in its original location (vendor/)
72+ if [ -z " $CMDER_ROOT " ] && [ -f " ${BASH_SOURCE[0]} " ]; then
73+ # Check if we're in the vendor directory
74+ script_dir=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " && pwd ) "
75+ if [[ " $script_dir " == * /vendor ]] || [[ " $script_dir " == * /vendor/* ]]; then
76+ # Extract the Cmder root (parent of vendor)
77+ CMDER_ROOT=" $( cd " $script_dir /.." && pwd ) "
78+ # Verify this looks like a Cmder installation
79+ if [ ! -d " ${CMDER_ROOT} /vendor" ]; then
80+ unset CMDER_ROOT
81+ fi
82+ fi
83+ fi
84+
7085if [ -n " $CMDER_ROOT " ]; then
7186 # Remove any trailing '/' from CMDER_ROOT
7287 CMDER_ROOT=" ${CMDER_ROOT%/ } "
You can’t perform that action at this time.
0 commit comments