Enhance cmder start directory.

The start directory of cmder is defined in that order:
1. The directory passed as parameter to the cmder executable
2. The `CMDER_START` environment variable
3. The `HOME` environment variable
4. The current user directory (`USERPROFILE` environment variable)

This commit also fix two issues:
* stating cmder with a path in parameter would set CMDER_START (whereas it may just be temporary)
* fix new line in cmd when starting cmder (this one was buggin me)
This commit is contained in:
Nicolas Arnaud-Cormos
2015-01-10 07:50:44 +01:00
parent 17b4525e60
commit e9300ca43f
6 changed files with 41 additions and 28 deletions

8
vendor/init.bat vendored
View File

@ -37,12 +37,4 @@
:: Set home path
@if not defined HOME set HOME=%USERPROFILE%
@if defined CMDER_START (
@cd /d "%CMDER_START%"
) else (
@if "%CD%\" == "%CMDER_ROOT%" (
@cd /d "%HOME%"
)
)
:: @call "%CMDER_ROOT%/bin/agent.cmd"

7
vendor/profile.ps1 vendored
View File

@ -30,10 +30,3 @@ if (Get-Module posh-git) {
Enable-GitColors
Start-SshAgent -Quiet
}
# Move to the wanted location
if (Test-Path Env:\CMDER_START) {
Set-Location -Path $Env:CMDER_START
} elseif ($Env:CMDER_ROOT -and $Env:CMDER_ROOT.StartsWith($pwd)) {
Set-Location -Path $Env:USERPROFILE
}