def data_dir_path(): r"""A path to the Menpo built in ./data folder on this machine. Returns ------- string The path to the local Menpo ./data folder """ return os.path.join(menpo_src_dir_path(), 'data')
For example, menpo/rasterize/c/shaders/myshader.frag generates: const GLchar myshader_frag_str [] = "shader contents here"... in the header file menpo/rasterize/c/shaders.h """ header_file = 'shaders.h' menpo_dir = menpo_src_dir_path() c_folder = reduce(os.path.join, [menpo_dir, 'menpo', 'rasterize', 'c']) shaders_folder = os.path.join(c_folder, 'shaders') header_filepath = os.path.join(c_folder, header_file) class Shader: def __init__(self, path): self.path = path self.shader_type = os.path.splitext(path)[-1][1:] self.name = os.path.splitext(os.path.split(path)[-1])[0] with open(path) as f: self.lines = f.readlines() self._c_string = convert_to_c_literal(self.lines) @property