lib/synvert/cli.rb in synvert-1.2.1 vs lib/synvert/cli.rb in synvert-1.2.2
- old
+ new
@@ -145,11 +145,11 @@
end
# List and print all available rewriters.
def list_available_rewriters
if Core::Rewriter.availables.empty?
- puts 'There is no snippet under ~/.synvert-ruby, please run `synvert-ruby --sync` to fetch snippets.'
+ puts "There is no snippet under #{default_snippets_name}, please run `synvert-ruby --sync` to fetch snippets."
return
end
if plain_output?
Core::Rewriter.availables.each do |group, rewriters|
@@ -320,10 +320,12 @@
File.write("lib/#{group}/#{name}.rb", lib_content)
File.write("spec/#{group}/#{name}_spec.rb", spec_content)
end
def default_snippets_home
- ENV['SYNVERT_SNIPPETS_HOME'] || File.join(ENV['HOME'], '.synvert-ruby')
+ # ENV['HOME'] may use \ as file separator,
+ # but File.join always uses / as file separator.
+ ENV['SYNVERT_SNIPPETS_HOME'] || File.join(ENV['HOME'].gsub("\\", "/"), '.synvert-ruby')
end
def plain_output?
@options[:format] == 'plain'
end