Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Convert arguments to absolute paths #17107

Merged
merged 1 commit into from
Sep 3, 2021
Merged

Conversation

okonomiyaki3000
Copy link
Contributor

This script launches cmd and has it launch atom with the passed arguments. The problem is that cmd will not (necessarily) start in the pwd. So, relative paths like . and .. have a different meaning. So we should first convert them to absolute paths with cygpath.

Try it yourself. Go to some directory in bash and run atom . Rather than opening your current bash pwd, you'll open $HOME because when cmd opens, that's where it will be. Now apply this change and try the same thing.

By the way, I only see this problem affecting MSysGit and MSys2. I can't say whether it affects other environments.

Requirements

  • Filling out the template is required. Any pull request that does not include enough information to be reviewed in a timely manner may be closed at the maintainers' discretion.
  • All new code requires tests to ensure against regressions

Description of the Change

In environments where cygpath is available, use it to convert any paths passed to atom.sh to absolute paths.

Alternate Designs

None

Why Should This Be In Core?

Because it makes atom work properly on the command line.

Benefits

MSys users will be able to run atom . to open the current directory in atom.

Possible Drawbacks

Probably none.

Verification Process

Tested as:
atom .
atom ..
atom . ..

As well as other combinations of relative and absolute paths. On both MSys2 and MSysGit

Applicable Issues

None

This script launches cmd and has it launch atom with the passed arguments. The problem is that cmd will not (necessarily) start in the pwd. So, relative paths like `.` and `..` have a different meaning. So we should first convert them to absolute paths with cygpath. 

Try it yourself. Go to some directory in bash and run `atom .` Rather than opening your current bash pwd, you'll open $HOME because when cmd opens, that's where it will be. Now apply this change and try the same thing. 

By the way, I only see this problem affecting MSysGit and MSys2. I can't say whether it affects other environments.
@maxbrunsfeld maxbrunsfeld added the windows Issues that occur on Windows but not on other platforms. label Aug 15, 2018
@maxbrunsfeld
Copy link
Contributor

This looks like a good change, but I'm not familiar with Cygwin myself. Could anyone (atom maintainer or otherwise) take this for a spin, just to confirm that it works as expected?

@Ben3eeE, @50Wliu, maybe? (Not sure if either of you use cygwin; if not, sorry for the ping).

Copy link
Contributor

@sadick254 sadick254 left a comment

Choose a reason for hiding this comment

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

This works as expected. I have been able to test it out on windows with Cygwin. 👍

@sadick254 sadick254 merged commit e5e919c into atom:master Sep 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
windows Issues that occur on Windows but not on other platforms.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants