def process_line(root_directory, file_directory, command_prefix, relative_path):
    'Extracts information from a .cmd line and creates an entry from it.\n\n    Args:\n        root_directory: The directory that was searched for .cmd files. Usually\n            used directly in the "directory" entry in compile_commands.json.\n        file_directory: The path to the directory the .cmd file was found in.\n        command_prefix: The extracted command line, up to the last element.\n        relative_path: The .c file from the end of the extracted command.\n            Usually relative to root_directory, but sometimes relative to\n            file_directory and sometimes neither.\n\n    Returns:\n        An entry to append to compile_commands.\n\n    Raises:\n        ValueError: Could not find the extracted file based on relative_path and\n            root_directory or file_directory.\n    '
    prefix = command_prefix.replace('\\#', '#').replace('$(pound)', '#')
    cur_dir = root_directory
    expected_path = os.path.join(cur_dir, relative_path)
    if (not os.path.exists(expected_path)):
        cur_dir = file_directory
        expected_path = os.path.join(cur_dir, relative_path)
        if (not os.path.exists(expected_path)):
            raise ValueError(('File %s not in %s or %s' % (relative_path, root_directory, file_directory)))
    return {'directory': cur_dir, 'file': relative_path, 'command': (prefix + relative_path)}
Extracts information from a .cmd line and creates an entry from it.

Args:
    root_directory: The directory that was searched for .cmd files. Usually
        used directly in the "directory" entry in compile_commands.json.
    file_directory: The path to the directory the .cmd file was found in.
    command_prefix: The extracted command line, up to the last element.
    relative_path: The .c file from the end of the extracted command.
        Usually relative to root_directory, but sometimes relative to
        file_directory and sometimes neither.

Returns:
    An entry to append to compile_commands.

Raises:
    ValueError: Could not find the extracted file based on relative_path and
        root_directory or file_directory.
def process_line(root_directory, file_directory, command_prefix, relative_path):
    'Extracts information from a .cmd line and creates an entry from it.\n\n    Args:\n        root_directory: The directory that was searched for .cmd files. Usually\n            used directly in the "directory" entry in compile_commands.json.\n        file_directory: The path to the directory the .cmd file was found in.\n        command_prefix: The extracted command line, up to the last element.\n        relative_path: The .c file from the end of the extracted command.\n            Usually relative to root_directory, but sometimes relative to\n            file_directory and sometimes neither.\n\n    Returns:\n        An entry to append to compile_commands.\n\n    Raises:\n        ValueError: Could not find the extracted file based on relative_path and\n            root_directory or file_directory.\n    '
    prefix = command_prefix.replace('\\#', '#').replace('$(pound)', '#')
    cur_dir = root_directory
    expected_path = os.path.join(cur_dir, relative_path)
    if (not os.path.exists(expected_path)):
        cur_dir = file_directory
        expected_path = os.path.join(cur_dir, relative_path)
        if (not os.path.exists(expected_path)):
            raise ValueError(('File %s not in %s or %s' % (relative_path, root_directory, file_directory)))
    return {'directory': cur_dir, 'file': relative_path, 'command': (prefix + relative_path)}