extract directives to files, add set directive