Closed tbowmo closed 2 years ago
can you tell in which version it was working?
I came from 3.x something (been a while since I updated)..
Found it, it was working until 6.42.0 something related to this but still have to check
func (env *environment) resolveConfigPath() {
if env.args == nil || env.args.Config == nil {
return
}
configFile := *env.args.Config
if strings.HasPrefix(configFile, "~") {
configFile = strings.TrimPrefix(configFile, "~")
configFile = filepath.Join(env.homeDir(), configFile)
}
if !filepath.IsAbs(configFile) {
if absConfigFile, err := filepath.Abs(configFile); err == nil {
configFile = absConfigFile
}
}
*env.args.Config = filepath.Clean(configFile)
}
The last call to filepath.Clean does the replacement
I do the same as you(one single config) but I have it in windows and I use the same one everywhere(git bash, wsl, macos). That way it works all the time.
@lnu that's because clean will adjust to a Windows path (as we're on Windows), I could validate if we're on Windows and bash (thus my dearest friend Cygwin) and not do it. This does mean we should really only allow full paths when using Cygwin as it will otherwise still break.
It's only the path to the config file that is "windowsified" ;) Paths to oh-my-posh executables are still with forward slashes, in the generated bash script.. So somehow it mixes things up?
@tbowmo we added quite a bit of additional logic to support this abomination of a shell but it keeps kicking us in the back. You have to realise it's faking unix in a Windows environment and as far as executables are concerned, they're running on Windows.
This issue has been automatically locked since there has not been any recent activity (i.e. last half year) after it was closed. It helps our maintainers focus on the active issues. If you have found a problem that seems similar, please open a discussion first, complete the body with all the details necessary to reproduce, and mention this issue as reference.
Code of Conduct
What happened?
After upgrade to oh-my-posh 6.42.4 my git-bash integration stopped working. I have a common omp.json file, located inside my wsl and referenced from both powershell and git-bash, as I switch between terminals depending on which tasks I have to work on, For git bash I reference the file as
//wsl$/Ubuntu-20.04/home/z6tqm/.posh/bowman.omp.json
When running oh-my-posh with this command:
oh-my-posh --init --shell bash --config "//wsl$/Ubuntu-20.04/home/z6tqm/.posh/bowman.omp.json"
the POSH_THEME variable is set toexport POSH_THEME="\\wsl$\Ubuntu-20.04\home\z6tqm\.posh\bowman.omp.json"
instead.This results in an error when running the autogenerated script with eval:
I tried piping the oh-my-posh autogenerated bash script to a file, changing the location for the theme:
is changed to:
then sourcing the file in git bash:
And hey presto, it works:
Note that all other filepaths in the autogenerated bash script is using forward slashes, only the location of the theme is converted to use backslash instead of forward slash.
Theme
What OS are you seeing the problem on?
Windows
Which shell are you using?
bash
Log output