Created
April 23, 2013 10:20
-
-
Save erukiti/5442429 to your computer and use it in GitHub Desktop.
Cygwinで無理矢理veeweeを動かすための VBoxManage.exeラッパー
UNIXパスをWindowsパスに変換してVBoxManageを起動する
※まだ不完全
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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