Giter Club home page Giter Club logo

Comments (6)

stinos avatar stinos commented on June 8, 2024 1

Right, I missed that you're probably running PS Core, hence it looks in $HOME\Documents\PowerShell not $HOME\Documents\WindowsPowerShell (but note that PS will load both $HOME\Documents\PowerShell\Profile.ps1 and $HOME\Documents\PowerShell\Microsoft.PowerShell_profile.ps1). I'm not sure if it's broot's job to fix this. Plus from a brief look over the code, it could be non-trivial to implement because the installation doesn't run in the shell but in Rust, and I'm not sure if that somehow has access to the shell which launched it somehow: ideally this should access $PSVersionTable or similar to check what it's being ran on.

Anyway, the typical fix for this PS/PS Core discrepancy is symlinking the WindowsPowershell to the Powershell directory or vice-versa.

from broot.

Canop avatar Canop commented on June 8, 2024

I'd like rusticians with knowledge of Windows to have a look there.

from broot.

stinos avatar stinos commented on June 8, 2024

However, my Profile file is different:

But br still works, right?

See https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_profiles?view=powershell-7.3

So imo what broot does here is correct, and the best option as well.

from broot.

alexxbb avatar alexxbb commented on June 8, 2024

But br still works, right?

Unfortunately no, I had to manually source the broot ps1 script in my $PROFILE, then br started working.

from broot.

AeliusSaionji avatar AeliusSaionji commented on June 8, 2024

I think we should be revisiting this; the install script is currently in a broken state anyway* and we need to get eyes on it.

*: Last I checked, needs to be installed twice before br works, and then br will have you install it a third time 🤪

Note: PScore is typically referred to as pwsh, while the version currently bundled with Windows is referred to as WindowsPowerShell. This will be the familiar nomenclature to anyone who opted to install pwsh.

I propose the following change:

  1. Respect the $PROFILE env var. Do not just assume profile.ps1. It creates unnecessary clutter and confusion. If we're using Microsoft.PowerShell_profile.ps1 then that's what you should be patching. I'd also suggest that the above should be the preferred default instead of Profile.ps1, when creating the profile for the user.
  2. If the user has pwsh, patch pwsh and not WindowsPowerShell, unless maybe we're willing to add a y/n prompt, or implement more involved logic to detect if symlinks/sourcing are in play.

By the by,
Instead of symlinking, you may want to /source/ one profile from the other. Also, implement guard statements for things that are not supported in the older powershell 5.

If ((Get-Host).version.major -gt 5) {
  // this won't run in powershell 5
}

from broot.

Canop avatar Canop commented on June 8, 2024

A focused PR not touching other systems could be welcome here.

from broot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.