Skip to content
This repository was archived by the owner on Sep 22, 2023. It is now read-only.
This repository was archived by the owner on Sep 22, 2023. It is now read-only.

Import Module fails when home./config is not present #61

@ikiris04

Description

@ikiris04

[chrischua@X-p1vnc0 PIM]$ pwsh
PowerShell 7.3.1
PS /users/[email protected]/GIT/ops-scripts/PIM> $psversiontable

Name Value


PSVersion 7.3.1
PSEdition Core
GitCommitId 7.3.1
OS Linux 4.18.0-372.32.1.el8_6.x86_64 #1 SMP Fri Oct 7 12:35:10 EDT 2022
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

PS /users/chrischua> get-module -listavailable MSAL.PS

Directory: /usr/local/share/powershell/Modules

ModuleType Version PreRelease Name PSEdition ExportedCommands


Script 4.37.0.0 MSAL.PS Core,Desk {Add-MsalClientApplication, Clear-MsalTokenCache, Enable-MsalTokenCacheOnDisk, Get-MsalAccount…}

PS /users/chrischua> $debugPreference='Continue'
PS /users/chrischua> import-module MSAL.PS
Join-Path: /usr/local/share/powershell/Modules/MSAL.PS/4.37.0.0/internal/Import-Config.ps1:21
Line |
21 | … = Join-Path ([System.Environment]::GetFolderPath([System.Environment+ …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot bind argument to parameter 'Path' because it is an empty string.
Join-Path: /usr/local/share/powershell/Modules/MSAL.PS/4.37.0.0/internal/Import-Config.ps1:22
Line |
22 | $Path = Join-Path $AppDataDirectory $Path
| ~~~~~~~~~~~~~~~~~
| Cannot bind argument to parameter 'Path' because it is null.

The command returns null because [System.Environment+SpecialFolder]::ApplicationData) is mapping to home/.config and if home/.config doesn't exist, it returns null
https://developers.redhat.com/blog/2018/11/07/dotnet-special-folder-api-linux#environment_getfolderpath

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions