mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 17:50:22 +00:00
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:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user