def set_directory(path=None):
old_path = get_directory()<EOL>terminate_server()<EOL>cache.clear()<EOL>if path:<EOL><INDENT>cache['<STR_LIT>'] = path<EOL>try:<EOL><INDENT>get_jar_info()<EOL><DEDENT>except Error:<EOL><INDENT>cache['<STR_LIT>'] = old_path<EOL>raise<EOL><DEDENT><DEDENT>
Set LanguageTool directory.