aboutsummaryrefslogtreecommitdiff
path: root/dev/run/src/bin/windows-folder-hide.ps1
diff options
context:
space:
mode:
author魏曹先生 <1992414357@qq.com>2026-08-19 05:54:00 +0800
committer魏曹先生 <1992414357@qq.com>2026-08-19 06:15:20 +0800
commitec9edc294fd5e7e29977fc7b0e6fb953422bc0e2 (patch)
treebbf89ef4457b8de8a8a9bca5668045d612d27572 /dev/run/src/bin/windows-folder-hide.ps1
parent06dfc27194c11e1d1033c292c759a1c5d82e780b (diff)
chore: reorganize dev tools into dev/ directory and consolidate configs
Move CI, dev tools, and configs from root-level scattered locations into a unified `dev/` directory structure. Update all references across build scripts, documentation, and editor configurations. Also consolidate editor config generation into build.rs for automated synchronization of rust-analyzer settings across VS Code and Zed.
Diffstat (limited to 'dev/run/src/bin/windows-folder-hide.ps1')
-rw-r--r--dev/run/src/bin/windows-folder-hide.ps1115
1 files changed, 115 insertions, 0 deletions
diff --git a/dev/run/src/bin/windows-folder-hide.ps1 b/dev/run/src/bin/windows-folder-hide.ps1
new file mode 100644
index 0000000..ff53202
--- /dev/null
+++ b/dev/run/src/bin/windows-folder-hide.ps1
@@ -0,0 +1,115 @@
+$skipDirs = @('.git', '.temp', 'target', 'node_modules', '.pnpm')
+$selfPath = (Get-Item -LiteralPath $MyInvocation.MyCommand.Path).Directory.FullName
+
+function Test-InSkipDir {
+ param(
+ [object]$Item
+ )
+ $path = if ($Item -is [string]) {
+ $Item
+ } elseif ($Item.PSPath) {
+ $Item.PSPath -replace '^.*::', ''
+ } else {
+ $Item.FullName
+ }
+
+ $parts = $path.Split([System.IO.Path]::DirectorySeparatorChar)
+ for ($i = 0; $i -lt $parts.Length - 1; $i++) {
+ if ($parts[$i] -in $skipDirs) {
+ return $true
+ }
+ }
+ return $false
+}
+
+function Invoke-UnhideRecursive {
+ param([string]$Path)
+ Get-ChildItem -LiteralPath $Path -Force | ForEach-Object {
+ if ($_.PSIsContainer) {
+ if ($_.Name -in $skipDirs) {
+ if ($_.Attributes -band [System.IO.FileAttributes]::Hidden) {
+ Write-Host " -> unhiding skip directory (self only): `"$($_.FullName)`""
+ $_.Attributes = $_.Attributes -bxor [System.IO.FileAttributes]::Hidden
+ }
+ return
+ }
+ Invoke-UnhideRecursive $_.FullName
+ } else {
+ if ($_.Attributes -band [System.IO.FileAttributes]::Hidden) {
+ Write-Host " -> unhiding: `"$($_.FullName)`""
+ $_.Attributes = $_.Attributes -bxor [System.IO.FileAttributes]::Hidden
+ }
+ }
+ }
+}
+
+function Test-GitPathSkippable {
+ param([string]$GitPath)
+ $parts = $GitPath.Split(@('/', '\'))
+ for ($i = 0; $i -lt $parts.Length - 1; $i++) {
+ if ($parts[$i] -in $skipDirs) {
+ return $true
+ }
+ }
+ return $false
+}
+
+Write-Host "Step 1: Unhiding all files and directories (skipping $($skipDirs -join ', '))..."
+
+Invoke-UnhideRecursive -Path (Get-Location).Path
+
+Write-Host "Step 2: Hiding git-ignored items..."
+
+git ls-files --others --ignored --exclude-standard | Where-Object {
+ -not (Test-GitPathSkippable $_)
+} | ForEach-Object {
+ $itemPath = $_
+ Write-Host "... checking: `"$itemPath`""
+ $item = Get-Item $_ -Force -ErrorAction SilentlyContinue
+ if (-not $item) { return }
+
+ if ($item.FullName -eq $selfPath) { return }
+
+ if (Test-InSkipDir $item) {
+ Write-Host " -> skipping (inside skip directory)"
+ return
+ }
+
+ if ($item.PSIsContainer) {
+ if (-not ($item.Attributes -band [System.IO.FileAttributes]::Hidden)) {
+ Write-Host " -> hiding directory (non-recursive)"
+ $item.Attributes = $item.Attributes -bor [System.IO.FileAttributes]::Hidden
+ }
+ } else {
+ if (-not ($item.Attributes -band [System.IO.FileAttributes]::Hidden)) {
+ Write-Host " -> hiding"
+ $item.Attributes = $item.Attributes -bor [System.IO.FileAttributes]::Hidden
+ }
+ }
+}
+
+Write-Host "Step 3: Hiding dot-prefixed items..."
+Get-ChildItem -Path . -Force -Directory | Where-Object { $_.Name -match '^\.' } | ForEach-Object {
+ Write-Host "... checking: `"$($_.FullName)`""
+ if (Test-InSkipDir $_) {
+ Write-Host " -> skipping (inside skip directory)"
+ return
+ }
+ if (-not ($_.Attributes -band [System.IO.FileAttributes]::Hidden)) {
+ Write-Host " -> hiding directory"
+ $_.Attributes = $_.Attributes -bor [System.IO.FileAttributes]::Hidden
+ }
+}
+
+Get-ChildItem -Path . -Force -File | Where-Object { $_.Name -match '^\.' } | ForEach-Object {
+ if ($_.FullName -eq $selfPath) { return }
+ Write-Host "... checking: `"$($_.FullName)`""
+ if (Test-InSkipDir $_) {
+ Write-Host " -> skipping (inside skip directory)"
+ return
+ }
+ if (-not ($_.Attributes -band [System.IO.FileAttributes]::Hidden)) {
+ Write-Host " -> hiding file"
+ $_.Attributes = $_.Attributes -bor [System.IO.FileAttributes]::Hidden
+ }
+}