Skip to content

Instantly share code, notes, and snippets.

@erukiti
Created April 23, 2013 10:20
Show Gist options
  • Save erukiti/5442429 to your computer and use it in GitHub Desktop.
Save erukiti/5442429 to your computer and use it in GitHub Desktop.
Cygwinで無理矢理veeweeを動かすための VBoxManage.exeラッパー UNIXパスをWindowsパスに変換してVBoxManageを起動する ※まだ不完全
#! /usr/bin/env ruby
# coding: utf-8
require 'shellwords'
class File
def self.to_windowspath(cygpath)
path = ""
cmd = "cygpath -w '#{cygpath}'"
IO.popen(cmd, 'r+') do |pipe|
path = pipe.read.strip
end
path
end
def self.cygpath?(cygpath)
/^\/cygdrive\// =~ cygpath
end
end
argv = ARGV.map {|arg| File.cygpath?(arg) ? File.to_windowspath(arg).shellescape : arg.shellescape}
print `/cygdrive/c/Program\\ Files/Oracle/VirtualBox/VBoxManage.exe #{argv.join(' ')}`
exit $?.exitstatus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment