Skip to content
This repository was archived by the owner on Jan 21, 2018. It is now read-only.
This repository was archived by the owner on Jan 21, 2018. It is now read-only.

binary_file_patterns not loaded from project settings? #57

@AllanLRH

Description

@AllanLRH

I have a lot of binary files in my project directory. Excluding them the with the file_exclude_patterns works, but the binary_file_patterns does not.

Here is my TODO-relevant project setup:

{
    "folders":
    [
        {
            "path": "/foo/bar/baz",
            "file_exclude_patterns": ["*.sim", "*.dat", "*.nb", "*.m~", "*.hdf"],
            "folder_exclude_patterns": ["folder1", "folder2"],
            "binary_file_patterns": ["*.hdf"]
        }
    ],

    "settings":
    {
        "todo":
        {
            "file_exclude_patterns":
            [
                "*.m~",
                "*.nb"
            ],
            "binary_file_patterns":
            [
                "*.hdf", // They are still searched!
            ]
        }
    }
}

When examening the code for the plugin, I wonder if the settings for binary files is even loaded from anywhere but the global settings... theese lines seems to be responsible for loading the file exclusion patterns. The next-to-last of theese lines is the only place in the file where the word binary is present.

ignored_dirs = settings.get('folder_exclude_patterns', [])
## Get exclude patterns from global settings
## Is there really no better way to access global settings?
global_settings = sublime.load_settings('Global.sublime-settings')
ignored_dirs.extend(global_settings.get('folder_exclude_patterns', []))

exclude_file_patterns = settings.get('file_exclude_patterns', [])
exclude_file_patterns.extend(global_settings.get('file_exclude_patterns', []))
exclude_file_patterns.extend(global_settings.get('binary_file_patterns', []))
exclude_file_patterns = [fnmatch.translate(patt) for patt in exclude_file_patterns]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions