Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set tasks to always use CMDER_START #803

Merged
merged 8 commits into from
Feb 8, 2016
Merged

Set tasks to always use CMDER_START #803

merged 8 commits into from
Feb 8, 2016

Conversation

MartiUK
Copy link
Member

@MartiUK MartiUK commented Jan 15, 2016

CMDER_START should always be set as a result of either:

  1. The user passes a directory to cmder.exe using /START $DIR OR
  2. Sets CMDER_START as a default environment variable.
    Fixes CMDER_START should always be set to USERPROFILE unless explicitly set through /START parameter #772

CMDER_START should always be set as a result of either:
1. The user passes a directory to cmder.exe using `/START $DIR`
- or -
2. Sets CMDER_START as a default environment variable.
Fixes #772
@jankatins
Copy link
Contributor

I don't understand the need for this. With #798, there are a few ways to startup:

  • cmder here in windows explorer: will call cmder.exe <path> and cmder.exe will set CMDER_START which will be picked up by init.bat or profile.ps1 and change to that dir
  • if a user specifies a CMDER_START this will take the same path as long as cmder.exe isn't called with a path/ /START (e.g. by "cmder here" or a commandline startup)
  • if no path is supplied (e.g. by starting it up by a shortcut or plain cmder.exe in the shell), the current task definition will ensure that the shells are started in USERPROFILE which IMO are exactly the right dir to start in.

So IMO we are ok with the "start in the right dir" problem. Or what is still missing (-> whats the to be solved problem in #772)?

IMO always setting CMDER_START will result that the task definitions startup dir will be useless, which I find not so nice, as it is quite a big button in the conemu UI.

@jankatins
Copy link
Contributor

Just to make that clear: the above is currently happening for PS and cmd, but not for bash tasks. To make that happen as well, this could be applied:

diff --git a/vendor/cmder.sh b/vendor/cmder.sh
index 4d1da3a..9e21e31 100644
--- a/vendor/cmder.sh
+++ b/vendor/cmder.sh
@@ -51,3 +51,8 @@ fi
 if [ -f "${HOME}/.bashrc" ] ; then
     . "${HOME}/.bashrc"
 fi
+
+if [ "$CMDER_START" != "" ] ; then
+    CMDER_START="$(cygpath -u "$CMDER_START")"
+    cd "${CMDER_START}"
+fi

[should be checked by someone familiar with bash...]

@MartiUK MartiUK changed the title Set tasks to always user CMDER_START Set tasks to always use CMDER_START Jan 29, 2016
USER_PROFILE is a known folder, so use that functionality to get it.
@MartiUK
Copy link
Member Author

MartiUK commented Feb 8, 2016

I've reverted the config changes, although I'll keep the launcher changes as they resolve some issues where CMDER_START isn't set in some instances.

MartiUK added a commit that referenced this pull request Feb 8, 2016
Set tasks to always use CMDER_START
@MartiUK MartiUK merged commit 7962eda into development Feb 8, 2016
@MartiUK MartiUK deleted the MartiUK-patch-1 branch February 8, 2016 19:00
{
wchar_t* homeProfile = 0;
SHGetKnownFolderPath(FOLDERID_Profile, 0, NULL, &homeProfile);
if (!SetEnvironmentVariable(L"CMDER_START", homeProfile)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IM this is still a bad change: init.bat will now always set the path to Home if cmder isn't started with a path. This means that startup path in the conemu config is completely useless now :-(

This also means that you can't do what's asked for in #203

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep just realised 😨

@jankatins
Copy link
Contributor

See inline comments: IMO always setting CMDER_START is wrong. what is the usecase for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants