astextplain: Try to workaround textconv vs symlinks problem on win32
[msysgit/kirr.git] / share / msysGit / add-shortcut.tcl
blob3a871f3ec4836b040b8d6396d5e5e26492a3d678
1 #!/mingw/bin/tclsh
3 cd [file dirname $argv0]
4 set msysRoot [file dirname [file dirname [pwd]]]
6 switch -regexp [lindex $argv 0] {
7 "^(|help|-h|-help|--help)$" {
8 puts "Usage: $argv0 \[option\]"
9 puts "Options:"
10 puts ""
11 puts " QuickLaunch create a QuickLaunch icon"
12 puts " Desktop create an icon on the Desktop"
13 puts " StartMenu create an icon in your start menu"
14 puts " StartMenu2 create an icon in start menu's Programs>msysGit"
15 puts " AllUsersStartMenu create an icon in All Users' start menu"
16 puts " AllUsersStartMenu2 create an icon in All Users'"
17 puts " start menu's Programs>msysGit"
18 puts " EnableQuickEdit enable the QuickEdit mode in the console"
19 puts ""
20 puts "Short options are q, d, s, s2, a and a2."
21 exit 1
23 "^(quicklaunch|QuickLaunch|q)$" {
24 set targetDirectory \
25 "$env(APPDATA)/Microsoft/Internet Explorer/Quick Launch"
27 "^(Desktop|desktop|d)$" {
28 set targetDirectory "$env(USERPROFILE)/Desktop"
30 "^(StartMenu|startmenu|start|s)$" {
31 package require registry 1.0
32 set key "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows"
33 set key "$key\\CurrentVersion\\Explorer\\Shell Folders"
34 set targetDirectory [registry get $key "Start Menu"]
36 "^(StartMenu2|startmenu2|start2|s2)$" {
37 set startMenuName "msysGit"
38 package require registry 1.0
39 set key "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows"
40 set key "$key\\CurrentVersion\\Explorer\\Shell Folders"
41 set programs [registry get $key "Programs"]
42 file mkdir $programs/$startMenuName
43 set targetDirectory $programs/$startMenuName
45 "^(AllUsersStartMenu|allusersstartmenu|allusers|a)$" {
46 package require registry 1.0
47 set key "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows"
48 set key "$key\\CurrentVersion\\Explorer\\Shell Folders"
49 set targetDirectory [registry get $key "Common Start Menu"]
51 "^(AllUsersStartMenu2|allusersstartmenu2|allusers2|a2)$" {
52 set startMenuName "msysGit"
53 package require registry 1.0
54 set key "HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows"
55 set key "$key\\CurrentVersion\\Explorer\\Shell Folders"
56 set programs [registry get $key "Common Programs"]
57 file mkdir $programs/$startMenuName
58 set targetDirectory $programs/$startMenuName
60 "^(EnableQuickEdit|quickedit)$" {
61 package require registry 1.0
62 set sh [string map { "\\" "_" "/" "_" } $msysRoot/bin/sh.exe]
63 set key "HKEY_CURRENT_USER\\Console"
64 registry set $key "QuickEdit" 1 dword
65 registry set $key "HistoryBufferSize" 999 dword
66 registry broadcast $key
67 registry broadcast "Console"
68 exit 0
70 default {
71 puts "Unknown argument: [lindex $argv 0]"
72 exit 1
76 exec make
78 set binDirectory "$msysRoot/bin"
79 set resDirectory "$msysRoot/share/resources"
81 set command "$binDirectory/sh.exe"
82 set arguments "--login -i"
83 if {[info exists env(COMMONPROGRAMW6432)] && $env(COMMONPROGRAMW6432) != ""} {
84 set command "%WINDIR%\\SysWOW64\\cmd.exe"
85 set arguments "/c \"$binDirectory/sh.exe\" --login -i"
87 exec ./create-shortcut.exe --work-dir "%HOMEDRIVE%%HOMEPATH%" \
88 --icon-file "$resDirectory/msysgitlogo.ico" \
89 --arguments $arguments \
90 $command \
91 "$targetDirectory/msysGit.lnk"