fix undefined local variable,definition_dir

Specifying an non writeable definition dir returned an undefined variable error rather than the helpful error message.