Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for settings on Linux and macOS #73

Merged
merged 5 commits into from
Oct 5, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Tools/YamlCreate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ if ($help) {
exit
}

# Set settings directory on basis of Operating System
# $IsWindows, $IsLinux and $IsMacOS were introduced in PowerShell 6.0+
# $env:OS for older versions of PowerShell
if ($IsWindows -or $env:OS) {
$script:SettingsPath = Join-Path $env:LOCALAPPDATA -ChildPath 'YamlCreate' # On Windows
} else {
$script:SettingsPath = Join-Path $env:HOME -ChildPath 'YamlCreate' # On Linux and macOS
vedantmgoyal9 marked this conversation as resolved.
Show resolved Hide resolved
}
# Check for settings directory and create it if none exists
$script:SettingsPath = Join-Path $env:LOCALAPPDATA -ChildPath 'YamlCreate'
if (!(Test-Path $script:SettingsPath)) { New-Item -ItemType 'Directory' -Force -Path $script:SettingsPath | Out-Null }
# Check for settings file and create it if none exists
$script:SettingsPath = $(Join-Path $script:SettingsPath -ChildPath 'Settings.yaml')
Expand Down