Fix WriteSettingsFile to refer to itself; enable setting data directory.