-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathorchat.ps1
More file actions
38 lines (31 loc) 路 1.16 KB
/
Copy pathorchat.ps1
File metadata and controls
38 lines (31 loc) 路 1.16 KB
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
# ORCHAT PowerShell Wrapper
# Provides better Windows integration
param(
[Parameter(ValueFromRemainingArguments=$true)]
[string[]]$Arguments
)
# Check WSL installation
if (-not (Get-Command wsl -ErrorAction SilentlyContinue)) {
Write-Host "ERROR: Windows Subsystem for Linux (WSL) is not installed." -ForegroundColor Red
Write-Host "Please install WSL from Microsoft Store." -ForegroundColor Yellow
Write-Host "Instructions: https://docs.microsoft.com/en-us/windows/wsl/install" -ForegroundColor Cyan
pause
exit 1
}
# Convert Windows path to WSL path
$CurrentDir = (Get-Location).Path
$WslPath = $CurrentDir -replace '^([A-Z]):', '/mnt/${1}' -replace '\\', '/'
# Prepare arguments for WSL
$WslArgs = @()
foreach ($arg in $Arguments) {
# Escape single quotes for bash
$escapedArg = $arg -replace "'", "''"
$WslArgs += "'$escapedArg'"
}
# Join arguments
$ArgumentString = $WslArgs -join ' '
Write-Host "ORCHAT Enterprise - Windows/WSL Bridge" -ForegroundColor Cyan
Write-Host "Running in WSL from: $WslPath" -ForegroundColor Gray
Write-Host ""
# Execute in WSL
wsl -d Ubuntu-24.04 bash -c "cd '$WslPath' && ~/.local/bin/orchat $ArgumentString"