Skip to content

Instantly share code, notes, and snippets.

@tarVolcano
Last active August 29, 2015 13:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarVolcano/9664947 to your computer and use it in GitHub Desktop.
Save tarVolcano/9664947 to your computer and use it in GitHub Desktop.
エディタラッパー for Cygwin : bashとrubyで比較
#!/bin/bash
argv=("$@")
for i in `seq 1 $#` ; do
case ${argv[$i-1]} in
-*) ;; # オプション引数はそのまま
*) argv[$i-1]=`cygpath -w "${argv[$i-1]}"` ;; # ファイルパスはcygpathで変換
esac
done
/cygdrive/d/opt/Sakura/sakura.exe ${argv[@]}
#!/bin/env ruby
# coding: utf-8
ary = ARGV
ary.length.times do |i|
if !(ary[i].start_with?("-")) then # 引数がパス名(-オプション以外)か?
IO.popen("cygpath -am '" + ary[i] + "'", 'r+') do |io|
ary[i] = io.read.chomp # 末尾に"\n"がつくので除去
end
end
end
system('/cygdrive/d/opt/Sakura/sakura.exe ' + ary.join(" "))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment