Skip to content

Commit 295f245

Browse files
author
James Brundage
committed
fix: Improving obs-powershell startup time ( Fixes #214 )
1 parent a1479cb commit 295f245

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

obs-powershell.ps.psm1

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
$CommandsPath = (Join-Path $PSScriptRoot "Commands")
2-
[Include('*-*.ps1')]$CommandsPath
1+
param()
2+
3+
if ((-not (Test-Path '.git')) -or $args -match 'production') {
4+
. $PSScriptRoot/allcommands.ps1
5+
} else {
6+
$CommandsPath = (Join-Path $PSScriptRoot "Commands")
7+
[Include('*-*.ps1')]$CommandsPath
8+
}
9+
10+
311

412
$MyInvocation.MyCommand.ScriptBlock.Module.OnRemove = {
513
Get-OBSEffect | Stop-OBSEffect
@@ -18,6 +26,7 @@ if ($home) {
1826
New-PSDrive -Name "my-$($MyModule.Name)" -Root (Join-Path $home ".$($myModule.Name)") -Description "My $MyModule" @NewDriveSplat
1927
}
2028

29+
#region obs-powershell startup
2130
foreach ($noun in 'Streaming','Recording') {
2231
foreach ($verb in 'Start', 'Stop') {
2332
Set-Alias "$verb-$noun" "$verb-OBS$($noun -replace 'ing')"
@@ -38,4 +47,6 @@ if (Test-Path $ModuleProfilePath) {
3847
. $ModuleProfilePath
3948
}
4049

50+
#endregion obs-powershell startup
51+
4152
Export-ModuleMember -Function * -Variable $script:variablesToExport -Alias *

0 commit comments

Comments
 (0)