New-FreshServiceConnection references the global variable "$FreshServiceConfigPath" (defined in FreshservicePS.psm1) which itself references "$env:APPDATA". "$env:APPDATA" is an environment variable that only exists on Windows. Since it doesn't exist, it generates the path string as "/FreshservicePS/FreshservicePS.config" which tries to write to the root directory and this fails due to permissions (as expected).
Expected Behavior
New-FreshServiceConnection runs and creates config file in appropriate directory
Current Behavior
New-FreshServiceConnection fails due to lack of $env:APPDATA directory on macOS
Possible Solution
Include logic to detect non-Windows systems and reference an appropriate environment variable to store the config file in a suitable location.
Steps to Reproduce (for bugs)
Install module in PowerShell Core on macOS
Run New-FreshServiceConnection cmdlet with required parameters
Error occurs (due to attempting to write to the root directory)
Context
Would like to actually use the module on any system.
Your Environment
Module version used: FreshservicePS 0.1.3
Operating System and PowerShell version: macOS 13.5.1, Powershell Core 7.3.6
New-FreshServiceConnection references the global variable "$FreshServiceConfigPath" (defined in FreshservicePS.psm1) which itself references "$env:APPDATA". "$env:APPDATA" is an environment variable that only exists on Windows. Since it doesn't exist, it generates the path string as "/FreshservicePS/FreshservicePS.config" which tries to write to the root directory and this fails due to permissions (as expected).
Expected Behavior
New-FreshServiceConnection runs and creates config file in appropriate directory
Current Behavior
New-FreshServiceConnection fails due to lack of $env:APPDATA directory on macOS
Possible Solution
Include logic to detect non-Windows systems and reference an appropriate environment variable to store the config file in a suitable location.
Steps to Reproduce (for bugs)
Context
Would like to actually use the module on any system.
Your Environment