-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReset-VSCodeCursor.ps1
More file actions
45 lines (39 loc) · 1.42 KB
/
Copy pathReset-VSCodeCursor.ps1
File metadata and controls
45 lines (39 loc) · 1.42 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
39
40
41
42
43
44
45
#.SYNOPSIS
# 恢复 Visual Studio Code 的原始指针样式,保持资源文件的完整性。
[CmdletBinding()]
[OutputType([void])]
[System.Diagnostics.CodeAnalysis.SuppressMessage(
'PSUseApprovedVerbs', '', Scope='Function', Target='Combine-Path')]
param
(
)
# 定义支持多个参数的路径拼接方法。
function Combine-Path
{
[System.IO.Path]::Combine([string[]]$args)
}
# 定义恢复指定源码文件的方法。
function Restore-VSCodeSource([string]$Path)
{
$BackupPath = "$Path.org"
if (Test-Path $BackupPath)
{
Remove-Item $Path
Move-Item $BackupPath $Path
}
}
# 初始化 Visual Studio Code 相关路径。
$CodeBinPath = Split-Path $(Get-Command code.cmd).Source -Parent
$VSCodeHome = $(Get-Item $(Join-Path $CodeBinPath ..)).FullName
$VSAppResDirName = Combine-Path * resources app out vs
$VSAppResDir = $(Get-Item $(Combine-Path $VSCodeHome $VSAppResDirName)).FullName
# 初始化主要工作台的 CSS 文件的路径。
$MainCssName = Combine-Path workbench workbench.desktop.main.css
$MainCssPath = Combine-Path $VSCodeHome $VSAppResDir $MainCssName
# 恢复主要工作台的 CSS 文件。
Restore-VSCodeSource $MainCssPath
# 初始化主要工作台的 JS 文件的路径。
$MainJsName = Combine-Path workbench workbench.desktop.main.js
$MainJsPath = Combine-Path $VSCodeHome $VSAppResDir $MainJsName
# 恢复主要工作台的 JS 文件。
Restore-VSCodeSource $MainJsPath