Sublime build for XML with different extension

175 views Asked by At

I have a project that uses a XML file of the type .uvprojx.

I have a sublime build I have found and modified slightly and it works fine but I can't get the build system to auto-detect that this is the build it needs to use. I need to manually go to Tools->Build systems -> My build.

This is my .sublime-build file:

{
    "cmd": ["python", "C:/Users/cag/Documents/Tasks/PythonMisc/UvisionWrapper.py", "UV4", "-b", "-j0", "${file}", "-o", "out.txt"],
    "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
    "working_dir": "${file_path}",
    "selector": "source.uvprojx",
    "variants":
    [
        {
        "name": "Flash",
        "shell":true,
            "cmd": ["python", "C:/Users/cag/Documents/Tasks/PythonMisc/UvisionWrapper.py", "UV4", "-f", "-j0", "${file}", "-o", "out.txt"]          
        },
        {
        "name": "Clean",
        "shell":true,
            "cmd": ["python", "C:/Users/cag/Documents/Tasks/PythonMisc/UvisionWrapper.py", "UV4", "-c", "-j0", "${file}", "-o", "out.txt"]          
        },
    ]
}

I have the python wrapper as the .exe file for the build creates a new process so I need to save the output to a file and read it in Python but anyway it works well.

What I want is that when I open a file with the extension .uvprojx this build is the default. If it matters Sublime detects this file as XML (which it is).

1

There are 1 answers

0
Keith Hall On BEST ANSWER

Change your selector to text.xml and add "file_patterns": ["*.uvprojx"], as per the documentation at http://www.sublimetext.com/docs/3/build_systems.html#options, then ST will auto-select the build system correctly for you.