-
Notifications
You must be signed in to change notification settings - Fork 9
/
install.bat
63 lines (46 loc) · 861 Bytes
/
install.bat
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
@echo off
:: Files to link
set files=ctags^
gemrc^
git-templates^
gitattributes_global^
gitconfig^
gitignore_global^
irbrc^
npmrc^
vimrc
:: Files to link into bin
set binfiles=diff-highlight^
diff-highlight.bat^
diff-hunk-list^
diff-hunk-list.bat^
server^
server.bat
:: Main
for %%a in (%files%) do (
call :replaceFile %%a
)
for %%a in (%binfiles%) do (
call :replaceFile bin\%%a bin\%%a
)
goto :EOF
:: Functions
:replaceFile
if not "%2" == "" (
set dest=%USERPROFILE%\%2
) else (
set dest=%USERPROFILE%\.%1
)
for %%f in ("%dest%") do set dirname=%%~dpf
if not exist %dirname% mkdir %dirname%
if exist %~dp0%1\* (
mklink /j %dest% %~dp0%1
) else (
mklink %dest% %~dp0%1
)
if %errorlevel% == 0 (
echo Created %dest%
) else (
echo Failed to create %dest%
)
goto :EOF