-
Notifications
You must be signed in to change notification settings - Fork 0
/
PSElvUI.psm1
51 lines (29 loc) · 1.03 KB
/
PSElvUI.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#Setup default paths for module in user home dir
$script:separator = [IO.Path]::DirectorySeparatorChar
switch ($PSVersionTable.PSEdition) {
'Desktop' {
$userDir = $env:USERPROFILE
}
'Core' {
switch ($PSVersionTable.Platform) {
'Win32NT' {
$userDir = $env:USERPROFILE
}
'Unix' {
$userDir = $env:HOME
}
}
}
}
$script:defaultPSElvUIDir = (Join-Path -Path $userDir -ChildPath '.pselvui')
$script:configDir = "$($defaultPsDsDir)$($separator)configs"
#Import functions
$Public = @( Get-ChildItem -Path "$PSScriptRoot$($separator)functions$($separator)public$($separator)*.ps1" )
$Private = @( Get-ChildItem -Path "$PSScriptRoot$($separator)functions$($separator)private$($separator)*.ps1" )
@($Public + $Private) | ForEach-Object {
Try {
. $_.FullName
} Catch {
Write-Error -Message "Failed to import function $($_.FullName): $_"
}
}