Can you set default save directory from script?

I’ve written a script for data analysis that does what I need, but the data reduction step outputs files into whatever directory I was last using in the GUI unless I remember to change the default save directory. Is there a way of changing the default directory from a script?
I’ve found that I need to change the Mantid.User.Properties file as in this link:
http://docs.mantidproject.org/nightly/concepts/PropertiesFile.html

but this suggests restarting mantid is then needed. I know this can be done without restarting in the gui. Is it possible to script?

Hi Ian,

You can see the current default save directory with
ConfigService.Instance().getString('defaultsave.directory')
and set it with
ConfigService.Instance().setString('defaultsave.directory', 'path/to/dir')

This will change it for the current session - if you look under File/Manage User Directories then the default save directory will be changed. To write the changed value to the mantid.user.properties file, use
ConfigService.Instance().saveConfig('path/to/mantid.user.properties').

Hope this helps,
Tom

Thanks Tom, Works great!