Remove trailing newline character
Implementation for select directory in Preferences behaviour