1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-05 16:52:59 +01:00
git/git-gui/lib/win32_shortcut.js
Junio C Hamano d794d9e70e Merge git://repo.or.cz/git-gui
* git://repo.or.cz/git-gui: (96 commits)
  git-gui 0.9.0
  git-gui: Bind Meta-T for "Stage To Commit" menu action
  git-gui: Allow users to set font weights to bold
  git-gui: Update Japanese strings (part 2)
  git-gui: Update Japanese strings
  Updated russian translation of git-gui
  po2msg: actually output statistics
  po2msg: ignore untranslated messages
  po2msg: ignore entries marked with "fuzzy"
  git-gui: Protect against bad translation strings
  git-gui: Make sure we get errors from git-update-index
  More updates and corrections to the russian translation of git-gui
  Updated Russian translation.
  git-gui: Update German translation
  git-gui: Add more terms to glossary.
  git-gui: Paper bag fix the global config parsing
  git-gui: Honor a config.mak in git-gui's top level
  git-gui: Collapse $env(HOME) to ~/ in recent repositories on Windows
  git-gui: Support cloning Cygwin based work-dirs
  git-gui: Use proper Windows shortcuts instead of bat files
  ...
2007-11-21 00:00:56 -08:00

34 lines
888 B
JavaScript

// git-gui Windows shortcut support
// Copyright (C) 2007 Shawn Pearce
var WshShell = WScript.CreateObject("WScript.Shell");
var argv = WScript.Arguments;
var argi = 0;
var lnk_path = argv.item(argi++);
var ico_path = argi < argv.length ? argv.item(argi++) : undefined;
var dir_path = argi < argv.length ? argv.item(argi++) : undefined;
var lnk_exec = argi < argv.length ? argv.item(argi++) : undefined;
var lnk_args = '';
while (argi < argv.length) {
var s = argv.item(argi++);
if (lnk_args != '')
lnk_args += ' ';
if (s.indexOf(' ') >= 0) {
lnk_args += '"';
lnk_args += s;
lnk_args += '"';
} else {
lnk_args += s;
}
}
var lnk = WshShell.CreateShortcut(lnk_path);
if (argv.length == 1) {
WScript.echo(lnk.TargetPath);
} else {
lnk.TargetPath = lnk_exec;
lnk.Arguments = lnk_args;
lnk.IconLocation = ico_path + ", 0";
lnk.WorkingDirectory = dir_path;
lnk.Save();
}