fork-dev / TrackerWin

Bug and issue tracker for Fork for Windows
459 stars 10 forks source link

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

Open arphox opened 11 months ago

arphox commented 11 months ago

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

DanPristupov commented 11 months ago

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

arphox commented 11 months ago

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 commented 11 months ago

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

arphox commented 11 months ago

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 commented 11 months ago

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 commented 10 months ago

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)