Skip to content

Instantly share code, notes, and snippets.

@castor4bit
Last active December 14, 2015 11:09
Show Gist options
  • Select an option

  • Save castor4bit/5077299 to your computer and use it in GitHub Desktop.

Select an option

Save castor4bit/5077299 to your computer and use it in GitHub Desktop.
Automatorで選択範囲の共有ディレクトリパスを、Windows/Macそれぞれに変換して出力
ARGF.each do |path|
path.force_encoding("UTF-8") unless path.nil?
puts path
if path =~ /^smb:/
puts path.gsub(%r|^smb://|, "\\\\\\").gsub(%r|/|, "\\")
else
puts "smb:#{path.gsub("\\", "/")}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment