You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
144 lines
3.5 KiB
144 lines
3.5 KiB
18 years ago
|
# git-gui desktop icon creators
|
||
|
# Copyright (C) 2006, 2007 Shawn Pearce
|
||
|
|
||
|
proc do_windows_shortcut {} {
|
||
15 years ago
|
global _gitworktree
|
||
18 years ago
|
set fn [tk_getSaveFile \
|
||
|
-parent . \
|
||
9 years ago
|
-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
|
||
17 years ago
|
-initialfile "Git [reponame].lnk"]
|
||
18 years ago
|
if {$fn != {}} {
|
||
17 years ago
|
if {[file extension $fn] ne {.lnk}} {
|
||
|
set fn ${fn}.lnk
|
||
18 years ago
|
}
|
||
8 years ago
|
# Use git-gui.exe if available (ie: git-for-windows)
|
||
|
set cmdLine [auto_execok git-gui.exe]
|
||
|
if {$cmdLine eq {}} {
|
||
|
set cmdLine [list [info nameofexecutable] \
|
||
|
[file normalize $::argv0]]
|
||
|
}
|
||
18 years ago
|
if {[catch {
|
||
8 years ago
|
win32_create_lnk $fn $cmdLine \
|
||
15 years ago
|
[file normalize $_gitworktree]
|
||
18 years ago
|
} err]} {
|
||
17 years ago
|
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
||
18 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
proc do_cygwin_shortcut {} {
|
||
15 years ago
|
global argv0 _gitworktree
|
||
18 years ago
|
|
||
|
if {[catch {
|
||
|
set desktop [exec cygpath \
|
||
|
--windows \
|
||
|
--absolute \
|
||
|
--long-name \
|
||
|
--desktop]
|
||
|
}]} {
|
||
|
set desktop .
|
||
|
}
|
||
|
set fn [tk_getSaveFile \
|
||
|
-parent . \
|
||
9 years ago
|
-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
|
||
18 years ago
|
-initialdir $desktop \
|
||
17 years ago
|
-initialfile "Git [reponame].lnk"]
|
||
18 years ago
|
if {$fn != {}} {
|
||
17 years ago
|
if {[file extension $fn] ne {.lnk}} {
|
||
|
set fn ${fn}.lnk
|
||
18 years ago
|
}
|
||
18 years ago
|
if {[catch {
|
||
|
set sh [exec cygpath \
|
||
|
--windows \
|
||
|
--absolute \
|
||
18 years ago
|
/bin/sh.exe]
|
||
18 years ago
|
set me [exec cygpath \
|
||
|
--unix \
|
||
|
--absolute \
|
||
|
$argv0]
|
||
17 years ago
|
win32_create_lnk $fn [list \
|
||
|
$sh -c \
|
||
16 years ago
|
"CHERE_INVOKING=1 source /etc/profile;[sq $me] &" \
|
||
17 years ago
|
] \
|
||
15 years ago
|
[file normalize $_gitworktree]
|
||
18 years ago
|
} err]} {
|
||
17 years ago
|
error_popup [strcat [mc "Cannot write shortcut:"] "\n\n$err"]
|
||
18 years ago
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
proc do_macosx_app {} {
|
||
|
global argv0 env
|
||
|
|
||
|
set fn [tk_getSaveFile \
|
||
|
-parent . \
|
||
9 years ago
|
-title [mc "%s (%s): Create Desktop Icon" [appname] [reponame]] \
|
||
18 years ago
|
-initialdir [file join $env(HOME) Desktop] \
|
||
|
-initialfile "Git [reponame].app"]
|
||
|
if {$fn != {}} {
|
||
18 years ago
|
if {[file extension $fn] ne {.app}} {
|
||
|
set fn ${fn}.app
|
||
|
}
|
||
18 years ago
|
if {[catch {
|
||
|
set Contents [file join $fn Contents]
|
||
|
set MacOS [file join $Contents MacOS]
|
||
|
set exe [file join $MacOS git-gui]
|
||
|
|
||
|
file mkdir $MacOS
|
||
|
|
||
|
set fd [open [file join $Contents Info.plist] w]
|
||
|
puts $fd {<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||
|
<plist version="1.0">
|
||
|
<dict>
|
||
|
<key>CFBundleDevelopmentRegion</key>
|
||
|
<string>English</string>
|
||
|
<key>CFBundleExecutable</key>
|
||
|
<string>git-gui</string>
|
||
|
<key>CFBundleIdentifier</key>
|
||
|
<string>org.spearce.git-gui</string>
|
||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||
|
<string>6.0</string>
|
||
|
<key>CFBundlePackageType</key>
|
||
|
<string>APPL</string>
|
||
|
<key>CFBundleSignature</key>
|
||
|
<string>????</string>
|
||
|
<key>CFBundleVersion</key>
|
||
|
<string>1.0</string>
|
||
|
<key>NSPrincipalClass</key>
|
||
|
<string>NSApplication</string>
|
||
|
</dict>
|
||
|
</plist>}
|
||
|
close $fd
|
||
|
|
||
|
set fd [open $exe w]
|
||
|
puts $fd "#!/bin/sh"
|
||
18 years ago
|
foreach name [lsort [array names env]] {
|
||
|
set value $env($name)
|
||
|
switch -- $name {
|
||
|
GIT_DIR { set value [file normalize [gitdir]] }
|
||
|
}
|
||
|
|
||
|
switch -glob -- $name {
|
||
|
SSH_* -
|
||
|
GIT_* {
|
||
|
puts $fd "if test \"z\$$name\" = z; then"
|
||
|
puts $fd " export $name=[sq $value]"
|
||
|
puts $fd "fi &&"
|
||
|
}
|
||
18 years ago
|
}
|
||
|
}
|
||
18 years ago
|
puts $fd "export PATH=[sq [file dirname $::_git]]:\$PATH &&"
|
||
|
puts $fd "cd [sq [file normalize [pwd]]] &&"
|
||
|
puts $fd "exec \\"
|
||
|
puts $fd " [sq [info nameofexecutable]] \\"
|
||
|
puts $fd " [sq [file normalize $argv0]]"
|
||
18 years ago
|
close $fd
|
||
|
|
||
|
file attributes $exe -permissions u+x,g+x,o+x
|
||
|
} err]} {
|
||
17 years ago
|
error_popup [strcat [mc "Cannot write icon:"] "\n\n$err"]
|
||
18 years ago
|
}
|
||
|
}
|
||
|
}
|