I’d say
mat_lib =os.path.dirname(os.path.realpath(__file__))+ os.sep + "materials.blend"
***
with bpy.data.libraries.load(mat_lib) as (data_from, data_to):
data_to.materials = [mat]
would work for both Win and Nix worlds.
Edit: How in the World one puts code snippets in this???