diff --git a/README.md b/README.md index 5a2637c..05f3473 100644 --- a/README.md +++ b/README.md @@ -55,7 +55,7 @@ Edit `config.psd1` before deploying: | Key | Description | Default | |---|---|---| | `UNCPath` | Base UNC path for clip storage — username subfolder created automatically | `\\server\ITCaptures` | -| `LogPath` | Base UNC path for script logs — username subfolder created automatically; each script writes its own log file | `\\server\ITLogs` | +| `LogPath` | Directory path for script logs — supports `%USERNAME%` and other environment variables; each script writes its own log file | `\\server\ITLogs\%USERNAME%` | | `BufferSeconds` | Replay buffer duration in seconds | `120` | | `WebSocketPort` | OBS WebSocket port — must match `obs-config/plugin_config/obs-websocket/config.json` | `4455` | | `OBSExecutable` | Full path to `obs64.exe` on the target machine | `C:\Program Files\obs-studio\bin\64bit\obs64.exe` | diff --git a/config.psd1 b/config.psd1 index 636f258..0da9312 100644 --- a/config.psd1 +++ b/config.psd1 @@ -2,9 +2,9 @@ # Base UNC path for saved clips — a subfolder per username is created automatically UNCPath = '\\server\ITCaptures' - # Base UNC path for script logs — a subfolder per username is created automatically + # Directory path for script logs — supports %USERNAME% and other environment variables # Each script writes its own log: OBSReplayBuffer.log, OBSReplayBuffer-Tray.log, OBSReplayBuffer-Save.log - LogPath = '\\server\ITLogs' + LogPath = '\\server\ITLogs\%USERNAME%' # Replay buffer duration in seconds (120 = 2 minutes) BufferSeconds = 120 diff --git a/scripts/Invoke-ReplaySave.ps1 b/scripts/Invoke-ReplaySave.ps1 index 8279b75..4882a27 100644 --- a/scripts/Invoke-ReplaySave.ps1 +++ b/scripts/Invoke-ReplaySave.ps1 @@ -21,7 +21,7 @@ if ($Port -eq 0) { # --- Start transcript logging --- try { - $logDir = Join-Path $config.LogPath $env:USERNAME + $logDir = [System.Environment]::ExpandEnvironmentVariables($config.LogPath) New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer-Save.log') -Append -ErrorAction Stop } catch { diff --git a/scripts/Show-ReplayTray.ps1 b/scripts/Show-ReplayTray.ps1 index c16d7b6..32d0e4c 100644 --- a/scripts/Show-ReplayTray.ps1 +++ b/scripts/Show-ReplayTray.ps1 @@ -15,7 +15,7 @@ Add-Type -AssemblyName System.Drawing # --- Start transcript logging --- try { $config = Import-PowerShellDataFile -Path (Join-Path $PSScriptRoot '..\config.psd1') - $logDir = Join-Path $config.LogPath $env:USERNAME + $logDir = [System.Environment]::ExpandEnvironmentVariables($config.LogPath) New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer-Tray.log') -Append -ErrorAction Stop } catch { diff --git a/scripts/Start-OBSReplayBuffer.ps1 b/scripts/Start-OBSReplayBuffer.ps1 index 79176fb..b05c0f6 100644 --- a/scripts/Start-OBSReplayBuffer.ps1 +++ b/scripts/Start-OBSReplayBuffer.ps1 @@ -17,7 +17,7 @@ $config = Import-PowerShellDataFile -Path $configPath # --- Start transcript logging --- try { - $logDir = Join-Path $config.LogPath $env:USERNAME + $logDir = [System.Environment]::ExpandEnvironmentVariables($config.LogPath) New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null Start-Transcript -Path (Join-Path $logDir 'OBSReplayBuffer.log') -Append -ErrorAction Stop } catch { @@ -69,6 +69,7 @@ Write-Host "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') [INFO] Detected resolution $obsConfigRoot = "$env:APPDATA\obs-studio" $sourceConfig = Join-Path $PSScriptRoot '..\obs-config' +New-Item -ItemType Directory -Path $obsConfigRoot -Force | Out-Null Copy-Item -Path "$sourceConfig\global.ini" -Destination "$obsConfigRoot\global.ini" -Force $wsConfigDir = "$obsConfigRoot\plugin_config\obs-websocket"