Last active
August 29, 2015 13:57
-
-
Save tarVolcano/9664947 to your computer and use it in GitHub Desktop.
エディタラッパー for Cygwin : bashとrubyで比較
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
#!/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[@]} |
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
#!/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