-
Notifications
You must be signed in to change notification settings - Fork 21
/
syncdokan.ps1
56 lines (46 loc) · 1.38 KB
/
syncdokan.ps1
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
46
47
48
49
50
51
52
53
54
55
# Script that synchronizes dokan
#
# Version: 20190810
Param (
[switch]$UseHead = $false,
[switch]$UseLegacyVersion = $false
)
$Git = "git"
If (${UseLegacyVersion})
{
# Patched version of dokan 0.6.0
$GitUrl = "https://github.com/joachimmetz/dokan.git"
$Destination = "..\dokan"
}
Else
{
$GitUrl = "https://github.com/dokan-dev/dokany.git"
$Destination = "..\dokany"
}
# PowerShell will raise NativeCommandError if git writes to stdout or stderr
# therefore 2>&1 is added and the output is stored in a variable.
$Output = Invoke-Expression -Command "${Git} clone ${GitUrl} ${Destination} 2>&1"
Push-Location ${Destination}
Try
{
$Output = Invoke-Expression -Command "${Git} fetch --quiet --all --tags --prune 2>&1"
$LatestTag = Invoke-Expression -Command "${Git} describe --tags --abbrev=0 2>&1"
If (${LatestTag} -and -not ${UseHead})
{
Write-Host "Synchronizing: dokan from ${GitUrl} tag ${LatestTag}"
$Output = Invoke-Expression -Command "${Git} checkout --quiet tags/${LatestTag} 2>&1"
}
Else
{
Write-Host "Synchronizing: dokan from ${GitUrl} HEAD"
}
If (-Not ${UseLegacyVersion})
{
# AppVeyor does not come with platform toolset version 142
((Get-Content -Path "..\dokany\dokan\dokan.vcxproj" -Raw) -Replace '<PlatformToolset>v142</PlatformToolset>','<PlatformToolset>v141</PlatformToolset>') | Set-Content -Path "..\dokany\dokan\dokan.vcxproj"
}
}
Finally
{
Pop-Location
}