Permalink
Browse files

Refine vimball extraction code (thx to @bronson)

  • Loading branch information...
1 parent 8e84cf8 commit fe8e7a9efe7820b25b8ac2a8bd51c6a05a008c9c @tmm1 tmm1 committed Dec 8, 2010
Showing with 5 additions and 4 deletions.
  1. +5 −4 Rakefile
View
@@ -56,8 +56,9 @@ def vim_plugin_task(name, repo=nil)
current = lines.shift until current =~ /finish$/ # find finish line
while current = lines.shift
- # first line is the filename, followed by some unknown data
- file = current[/^(.+?)\s+\[\[\[(\d+)$/, 1]
+ # first line is the filename (possibly followed by garbage)
+ # some vimballs use win32 style path separators
+ path = current[/^(.+?)(\t\[{3}\d)?$/, 1].gsub '\\', '/'
# then the size of the payload in lines
current = lines.shift
@@ -68,8 +69,8 @@ def vim_plugin_task(name, repo=nil)
# install the data
Dir.chdir dir do
- mkdir_p File.dirname(file)
- File.open(file, 'w'){ |f| f.write(data) }
+ mkdir_p File.dirname(path)
+ File.open(path, 'w'){ |f| f.write(data) }
end
end
end

0 comments on commit fe8e7a9

Please sign in to comment.