1
- # Requires -RunAsAdministrator
1
+ # Requires -RunAsAdministrator
2
2
#
3
- # File Browser Installer Script
3
+ # File Browser Installer Script
4
4
#
5
5
# GitHub: https://github.com/filebrowser/filebrowser
6
6
# Issues: https://github.com/filebrowser/filebrowser/issues
9
9
#
10
10
# iwr -useb https://raw.githubusercontent.com/filebrowser/get/master/get.ps1 | iex
11
11
#
12
- # You should run it as administrator so it can add filemanager to
12
+ # You should run it as administrator so it can add filemanager to
13
13
# the PATH.
14
14
#
15
15
function Install-FileManager {
@@ -24,14 +24,21 @@ function Install-FileManager {
24
24
}
25
25
26
26
$file = " windows-$arch -filebrowser.zip"
27
- $url = " https://github.com/filebrowser/filebrowser/releases/download/$tag /$file "
27
+
28
+ # Support env.RELEASE_MIRROR such as `https://gh.api.99988866.xyz/https://github.com`
29
+ $release_base = " https://github.com"
30
+ if ($env: RELEASE_MIRROR ) {
31
+ $release_base = $env: RELEASE_MIRROR
32
+ }
33
+ $url = " $release_base /filebrowser/filebrowser/releases/download/$tag /$file "
34
+
28
35
$temp = New-TemporaryFile
29
36
$folder = " ${env: ProgramFiles} \filebrowser"
30
37
31
38
Write-Host " Downloading" $url
32
- $WebClient = New-Object System.Net.WebClient
33
- $WebClient.DownloadFile ( $url , $temp )
34
-
39
+ $WebClient = New-Object System.Net.WebClient
40
+ $WebClient.DownloadFile ( $url , $temp )
41
+
35
42
Write-Host " Extracting $temp .zip"
36
43
Move-Item $temp " $temp .zip"
37
44
Expand-Archive " $temp .zip" - DestinationPath $temp
@@ -51,13 +58,13 @@ function Install-FileManager {
51
58
Remove-Item - Force - Recurse " $temp "
52
59
53
60
Write-Host " Adding filemanager to the PATH"
54
- if ((Get-Command " pandoc.exe" - ErrorAction SilentlyContinue) -eq $null ) {
61
+ if ((Get-Command " pandoc.exe" - ErrorAction SilentlyContinue) -eq $null ) {
55
62
$path = (Get-ItemProperty - Path ' Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' - Name PATH).Path
56
63
$path = $path + " ;$folder "
57
64
Set-ItemProperty - Path ' Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' - Name PATH - Value " $path "
58
65
}
59
66
60
- Write-Host " filemanager successfully installed!" - ForegroundColor Green
67
+ Write-Host " filemanager successfully installed!" - ForegroundColor Green
61
68
}
62
69
63
70
Install-FileManager
0 commit comments