hpcflow / install-scripts

Scripts to install pyinstaller folder version on a local machine.
0 stars 0 forks source link

Powershell error when `Import-Alias`ing aliases that already exist #58

Open aplowman opened 1 year ago

aplowman commented 1 year ago

At the end of the powershell install script, we execute the users profile: https://github.com/hpcflow/install-scripts/blob/5b8cf0ec101d10e7b35fec7c35af5f72209ce10e/src/install-hpcflow.ps1#L383

If previously run, the profile will include lines like:

Import-Alias C:\path\to\AppData\Local\matflow\aliases\matflow_aliases.csv

However, the profile has probably already been loaded, so the aliases will already exist, resulting in errors like:

Screenshot 2023-08-30 122252

cjfullerton commented 1 year ago

I'm aware of this one - my proposal is to use Remove-Alias to clear any aliases that are being created when the profile is being re-loaded.

For the 'unversal link' aliases (matflow, matflow-dev, etc) the older entries will also need to be removed from the aliases/matflow_aliases.csv file.

cjfullerton commented 1 year ago

Note: need to check what happens when Remove-Alias is used to remove an alias that doesn't exist.