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

$path / ${repo:path} custom command variable misses directory separators #2043

Open
arphox opened this issue Oct 4, 2023 · 6 comments
Open

Comments

@arphox
Copy link

arphox commented Oct 4, 2023

Hi!

The $path and ${repo:path} custom command variables miss directory separators.

Its value is D:workrepos_localRUConsumptionSimulator while it is actually D:\work\repos\_local\RUConsumptionSimulator and so on.

Demonstration: I have the following custom command:

kép

and its output is:
kép

Fork version: 1.89.2.0
Windows version: 21H2

@arphox arphox changed the title $path / ${repo:path} custom command variable misses directory separators ('\') $path / ${repo:path} custom command variable misses directory separators Oct 4, 2023
@DanPristupov
Copy link
Contributor

I will check that. However, why do you need it? The working directory is the repo path.
echo "$PWD"

@arphox
Copy link
Author

arphox commented Oct 6, 2023

I will check that. However, why do you need it? The working directory is the repo path. echo "$PWD"

I was trying to make a custom command which opens the windows terminal, like this (copied from #961):

{
"name": "Open in Windows Terminal",
"target": "repository",
"action": {
"type": "sh",
"script": "wt -d \"$path\"",
"showOutput": false,
"waitForExit": false
}

@DanPristupov
Copy link
Contributor

Did you try to select 'Windows Terminal' in File -> Preferences -> Integration?

@arphox
Copy link
Author

arphox commented Oct 6, 2023

Did you try to select 'Windows Terminal' in File -> Preferences -> Integration?

Thanks for letting me know, I just wanted to play with custom commands, I'm fine with the default git bash. :)

By the way the pwd works as workaround:

{
  "action": {
    "script": "wt -d \"$PWD\"",
    "showOutput": false,
    "type": "sh",
    "waitForExit": false
  },
  "name": "Open in Windows Terminal",
  "target": "repository"
}

@DanPristupov
Copy link
Contributor

DanPristupov commented Oct 6, 2023

I don't have an access to my Windows machine right now, but another workaround probably is to use Start Process type custom command with wt -d "${repo:path}" argument.

@sodwyer
Copy link

sodwyer commented Nov 7, 2023

Hi!

Just wanted to say I'm having pretty much the same issue when trying to make a custom command to apply a patch file with some extra options. I'm using the Path Text Box control with Open File dialog type in order to find the patch file but the path coming back through the $1{path} variable is missing it's separators.

Not a big deal as your Start Process workaround works a treat 👍

If you wonder why I wanted a custom apply patch, the built in one fails with this error:

error: patch failed: <file>
error: <file>: patch does not apply
error: Did you hand edit your patch?

stack overflow suggests this and it works fine
git apply --reject --whitespace=fix mychanges.patch
https://stackoverflow.com/questions/4770177/git-apply-fails-with-patch-does-not-apply-error

The patch is being generated by Fork on my work machine (win10) then attempted to apply on my home machine (win 11)

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

No branches or pull requests

3 participants