forked from joranvar/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.ps1
35 lines (30 loc) · 819 Bytes
/
install.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
Function New-Symlink ($link, $target)
{
if (Test-Path -Pathtype container $target)
{
$command = "/c mklink /d"
}
else
{
$command = "/c mklink"
}
Start-Process cmd -Verb RunAs -ArgumentList "$command $link $target"
}
$myPath = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
Foreach ($i in @("antigen","config\git","emacs.d\init.el","emacs.d\lisp","xmobarrc","xmonad\xmonad.hs","zshrc")) {
$target = $env:UserProfile + "\." + $i
if (Test-Path -Pathtype container $i)
{
$targetFolder = $i
}
else
{
$targetFolder = Split-Path -Path $target -Parent
}
New-Item -Path $targetFolder -Type directory -Force
echo $target
if (! (Test-Path $target))
{
New-Symlink $target ($myPath + "\" + $i)
}
}