Use File.directory? to test for local directories

Some of our submodules end in ".tmLanguage", which we used to think
meant it was a file rather than a directory.
This commit is contained in:
Adam Roben
2015-01-06 13:31:26 -05:00
parent 581dc36c47
commit 917bc48348

View File

@@ -159,15 +159,14 @@ end
def load_grammars(tmp_dir, source, all_scopes) def load_grammars(tmp_dir, source, all_scopes)
is_url = source.start_with?("http:", "https:") is_url = source.start_with?("http:", "https:")
return [] if is_url && !$options[:remote] return [] if is_url && !$options[:remote]
is_single_file = source.end_with?('.tmLanguage', '.plist')
p = if !is_url p = if !is_url
if is_single_file if File.directory?(source)
SingleFile.new(source)
else
DirectoryPackage.new(source) DirectoryPackage.new(source)
else
SingleFile.new(source)
end end
elsif is_single_file elsif source.end_with?('.tmLanguage', '.plist')
SingleGrammar.new(source) SingleGrammar.new(source)
elsif source.start_with?('https://github.com') elsif source.start_with?('https://github.com')
GitHubPackage.new(source) GitHubPackage.new(source)