Skip to content

Instantly share code, notes, and snippets.

@simensen
Created May 29, 2026 13:18
Show Gist options
  • Select an option

  • Save simensen/98e1c965b1dc87c8d73a65795d70d30d to your computer and use it in GitHub Desktop.

Select an option

Save simensen/98e1c965b1dc87c8d73a65795d70d30d to your computer and use it in GitHub Desktop.
Fix Solo paths for Windows Beta
$DbPath = Join-Path $env:USERPROFILE '.config\soloterm\solo.db'
function Show-Projects($Label) {
Write-Host "`n$Label" -ForegroundColor Cyan
sqlite3 $DbPath 'SELECT id, path FROM projects'
}
function Invoke-Fix([string]$UpdateSql) {
[int](sqlite3 -list $DbPath "$UpdateSql; SELECT changes();")
}
function Write-FixResult([int]$Count, [string]$Description) {
$color = if ($Count -gt 0) { 'Green' } else { 'DarkGray' }
$word = if ($Count -eq 1) { 'path' } else { 'paths' }
Write-Host "$Count $Description project $word fixed" -ForegroundColor $color
}
Show-Projects 'Before:'
# UNC fix must run first: \\?\UNC\... would otherwise match the bare \\?\ rule
$uncFixed = Invoke-Fix @"
UPDATE projects SET path = '\' || SUBSTR(path, 8)
WHERE SUBSTR(path, 1, 8) = '\\?\UNC\'
"@
$winFixed = Invoke-Fix @"
UPDATE projects SET path = SUBSTR(path, 5)
WHERE SUBSTR(path, 1, 4) = '\\?\'
"@
Show-Projects 'After:'
Write-Host ''
Write-FixResult $winFixed 'Windows-style'
Write-FixResult $uncFixed 'WSL-style'
@simensen

Copy link
Copy Markdown
Author

Successful run will output the following:


Before:
╭────┬────────────────────────────────────────────────────────────────────────────────╮
│ id │                                     path                                       │
╞════╪════════════════════════════════════════════════════════════════════════════════╡
│  7 │ \\?\C:\Users\bsimensen\f                                                       │
│  6 │ \\?\UNC\wsl.localhost\ACME-Ubuntu-24.04\home\bsimensen\Workspaces\dev\acmeapps │
╰────┴────────────────────────────────────────────────────────────────────────────────╯

After:
╭────┬──────────────────────────────────────────────────────────────────────────╮
│ id │                                   path                                   │
╞════╪══════════════════════════════════════════════════════════════════════════╡
│  7 │ C:\Users\bsimensen\f                                                     │
│  6 │ \\wsl.localhost\ACME-Ubuntu-24.04\home\bsimensen\Workspaces\dev\acmeapps │
╰────┴──────────────────────────────────────────────────────────────────────────╯

0 Windows-style project paths fixed
0 WSL-style project paths fixed

Safe to run multiple times as new projects are added or if paths get reverted somehow:


Before:
╭────┬──────────────────────────────────────────────────────────────────────────╮
│ id │                                   path                                   │
╞════╪══════════════════════════════════════════════════════════════════════════╡
│  7 │ C:\Users\bsimensen\f                                                     │
│  6 │ \\wsl.localhost\ACME-Ubuntu-24.04\home\bsimensen\Workspaces\dev\acmeapps │
╰────┴──────────────────────────────────────────────────────────────────────────╯

After:
╭────┬──────────────────────────────────────────────────────────────────────────╮
│ id │                                   path                                   │
╞════╪══════════════════════════════════════════════════════════════════════════╡
│  7 │ C:\Users\bsimensen\f                                                     │
│  6 │ \\wsl.localhost\ACME-Ubuntu-24.04\home\bsimensen\Workspaces\dev\acmeapps │
╰────┴──────────────────────────────────────────────────────────────────────────╯

0 Windows-style project paths fixed
0 WSL-style project paths fixed

@simensen

Copy link
Copy Markdown
Author
λ ~ › .\fix-solo.ps1

Before:
╭────┬────────────────────────────────────────────────────────────────────────────────────────────────╮
│ id │                                              path                                              │
╞════╪════════════════════════════════════════════════════════════════════════════════════════════════╡
│ 10 │ \\?\UNC\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Code\bizapps-symfony-bot                 │
│  9 │ \\?\UNC\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Code\gitlab-unified-linkifyer-userscript │
│ 11 │ \\?\UNC\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Code\images                              │
│ 12 │ \\?\UNC\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Code\litellm                             │
│  6 │ \\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Workspaces\dev\abcapps                         │
│  8 │ \\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Workspaces\performance\abcapps                 │
╰────┴────────────────────────────────────────────────────────────────────────────────────────────────╯

After:
╭────┬──────────────────────────────────────────────────────────────────────────────────────────╮
│ id │                                           path                                           │
╞════╪══════════════════════════════════════════════════════════════════════════════════════════╡
│ 10 │ \\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Code\bizapps-symfony-bot                 │
│  9 │ \\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Code\gitlab-unified-linkifyer-userscript │
│ 11 │ \\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Code\images                              │
│ 12 │ \\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Code\litellm                             │
│  6 │ \\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Workspaces\dev\abcapps                   │
│  8 │ \\wsl.localhost\ABC-Ubuntu-24.04\home\bsimensen\Workspaces\performance\abcapps           │
╰────┴──────────────────────────────────────────────────────────────────────────────────────────╯

0 Windows-style project paths fixed
4 WSL-style project paths fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment