-
Notifications
You must be signed in to change notification settings - Fork 16
/
CopyLibs.ps1
115 lines (100 loc) · 3.89 KB
/
CopyLibs.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# -------------------------------------------------------
# CopyLibs.ps1
#
# Copyright (c) 2021 takkaO
#
# If you use, modify, or redistribute this file independently
# of the original repository, this program is licensed under
# the MIT License.
#
# If you use, modify or redistribute this file as part of
# the original repository, please follow the repository's license.
#
# -------------------------------------------------------
$targetDirs = Get-ChildItem -Directory | Where-Object { $_.Name -match "^freetype.*"}
if ($targetDirs.Length -eq 0) {
Write-Host "Not Found FreeType project directory." -ForegroundColor Red
exit
}
$title = "Delete a FreeType libraries in OpenFontRender that already exists."
$message = "Are you sure you want to proceed ?"
$typename = "System.Management.Automation.Host.ChoiceDescription"
$yes = new-object $typename("&Yes","Delete")
$no = new-object $typename("&No","Exit")
$assembly= $yes.getType().AssemblyQualifiedName
$choice = new-object "System.Collections.ObjectModel.Collection``1[[$assembly]]"
$choice.add($yes)
$choice.add($no)
$answer = $host.ui.PromptForChoice($title,$message,$choice,1)
if ($answer -eq 1) {
Write-Host "The process has been suspended by user."
exit
}
Remove-Item "./src/freetype" -Recurse -Force -ErrorAction Ignore
Remove-Item "./src/base" -Recurse -Force -ErrorAction Ignore
Remove-Item "./src/cache" -Recurse -Force -ErrorAction Ignore
Remove-Item "./src/sfnt" -Recurse -Force -ErrorAction Ignore
Remove-Item "./src/smooth" -Recurse -Force -ErrorAction Ignore
Remove-Item "./src/truetype" -Recurse -Force -ErrorAction Ignore
Remove-Item "./src/ft2build.h" -Recurse -Force -ErrorAction Ignore
$FreeTypeDir = $targetDirs[0]
Write-Output "** Start Copying the necessary files **"
## Source files
$childDir = "freetype"
$targetPath = $FreeTypeDir.Name + "/include/" + $childDir
Write-Output ("Copying [" + $targetPath + "]")
if (!(Test-Path $targetPath)) {
Write-Host "Not Found " + $targetPath -ForegroundColor Red
exit
}
Copy-Item $targetPath -destination ("./src/" + $childDir) -recurse
$childDir = "base"
$targetPath = $FreeTypeDir.Name + "/src/" + $childDir
Write-Output ("Copying [" + $targetPath + "]")
if (!(Test-Path $targetPath)) {
Write-Host "Not Found " + $targetPath -ForegroundColor Red
exit
}
Copy-Item $targetPath -destination ("./src/" + $childDir) -recurse
$childDir = "cache"
$targetPath = $FreeTypeDir.Name + "/src/" + $childDir
Write-Output ("Copying [" + $targetPath + "]")
if (!(Test-Path $targetPath)) {
Write-Host "Not Found " + $targetPath -ForegroundColor Red
exit
}
Copy-Item $targetPath -destination ("./src/" + $childDir) -recurse
$childDir = "sfnt"
$targetPath = $FreeTypeDir.Name + "/src/" + $childDir
Write-Output ("Copying [" + $targetPath + "]")
if (!(Test-Path $targetPath)) {
Write-Host "Not Found " + $targetPath -ForegroundColor Red
exit
}
Copy-Item $targetPath -destination ("./src/" + $childDir) -recurse
$childDir = "smooth"
$targetPath = $FreeTypeDir.Name + "/src/" + $childDir
Write-Output ("Copying [" + $targetPath + "]")
if (!(Test-Path $targetPath)) {
Write-Host "Not Found " + $targetPath -ForegroundColor Red
exit
}
Copy-Item $targetPath -destination ("./src/" + $childDir) -recurse
$childDir = "truetype"
$targetPath = $FreeTypeDir.Name + "/src/" + $childDir
Write-Output ("Copying [" + $targetPath + "]")
if (!(Test-Path $targetPath)) {
Write-Host "Not Found " + $targetPath -ForegroundColor Red
exit
}
Copy-Item $targetPath -destination ("./src/" + $childDir) -recurse
## Header file
$childFile = "ft2build.h"
$targetPath = $FreeTypeDir.Name + "/include/" + $childFile
Write-Output ("Copying [" + $targetPath + "]")
if (!(Test-Path $targetPath)) {
Write-Host "Not Found " + $targetPath -ForegroundColor Red
exit
}
Copy-Item $targetPath -destination ("./src/" + $childFile)
Write-Host "** Success to all progress **"