MCPcopy Create free account
hub / github.com/Segs/Segs / createSettingsFile

Method createSettingsFile

Components/Settings.cpp:109–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107}
108
109void Settings::createSettingsFile(const QString &new_file_path)
110{
111 qCDebug(logSettings) << "Creating Settings file" << new_file_path;
112 QFile tpl_file(Settings::getSettingsTplPath());
113 QFile new_file(new_file_path);
114
115 if(!tpl_file.open(QIODevice::ReadOnly))
116 {
117 qWarning() << "Unable to read" << tpl_file.fileName() << "Check folder permissions.";
118 return;
119 }
120
121 // QSettings setValue() methods delete all file comments, it's better to
122 // simply copy the template over to our destination directory.
123 // Unfortunately QFile::copy() has some sort of bug and doesn't work
124 // so instead let's open the new file, and copy the contents from template
125 if(!new_file.open(QIODevice::WriteOnly) || !new_file.write(tpl_file.readAll()))
126 {
127 qWarning() << "Unable to create" << new_file_path << "Check folder permissions.";
128 return;
129 }
130
131 new_file.close();
132 tpl_file.close();
133}
134
135void settingsDump()
136{

Callers

nothing calls this directly

Calls 2

openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected