Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

ignore corrupt/unparsable tmThemes such as GitHub.tmTheme

  • Loading branch information...
commit e490dbf7fea6caf443b22860b924f64d21bd2359 1 parent 52638c9
@drnic authored
Showing with 9 additions and 4 deletions.
  1. +2 −1  Commands/Copy as RTF.tmCommand
  2. +7 −3 Support/lib/copy_as_rtf.rb
View
3  Commands/Copy as RTF.tmCommand
@@ -7,7 +7,8 @@
require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/copy_as_rtf.rb"
require "#{ENV['TM_SUPPORT_PATH']}/lib/progress.rb"
doc = RtfExporter.new.generate_rtf( STDIN.read )
-Kernel.open('|pbcopy','w+') do |f|
+`echo "hi" | pbcopy`
+Kernel.open('|pbcopy','w') do |f|
f.write(doc)
end
print doc
View
10 Support/lib/copy_as_rtf.rb
@@ -66,7 +66,7 @@ def generate_stylesheet_from_theme(theme_class = nil)
# Load the active theme. Unfortunately, this requires us to scan through
# all discoverable theme files...
unless theme_plist = find_theme(theme_uuid)
- print "Could not locate your theme file!"
+ print "Could not locate your theme file or it may be corrupt or unparsable!"
abort
end
@@ -149,8 +149,12 @@ def find_theme(uuid)
if File.exists? theme_dir
themes = Dir.entries(theme_dir).find_all { |theme| theme =~ /.+\.(tmTheme|plist)$/ }
themes.each do |theme|
- plist = OSX::PropertyList.load(File.open("#{theme_dir}/#{theme}"))
- return plist if plist["uuid"] == uuid
+ begin
+ plist = OSX::PropertyList.load(File.open("#{theme_dir}/#{theme}"))
+ return plist if plist["uuid"] == uuid
+ rescue OSX::PropertyListError => e
+ # puts "Error parsing theme #{theme_dir}/#{theme}" - e.g. GitHub.tmTheme has issues
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.