MCPcopy Create free account
hub / github.com/TheAssassin/AppImageLauncher / createConfigFile

Function createConfigFile

src/shared/shared.cpp:108–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108void createConfigFile(int askToMove,
109 const QString& destination,
110 int enableDaemon,
111 const QStringList& additionalDirsToWatch,
112 int monitorMountedFilesystems) {
113 auto configFilePath = getConfigFilePath();
114
115 QFile file(configFilePath);
116 file.open(QIODevice::WriteOnly);
117
118 // cannot use QSettings because it doesn't support comments
119 // let's do it manually and hope for the best
120 file.write("[AppImageLauncher]\n");
121
122 if (askToMove < 0) {
123 file.write("# ask_to_move = true\n");
124 } else {
125 file.write("ask_to_move = ");
126 if (askToMove == 0) {
127 file.write("false");
128 } else {
129 file.write("true");
130 }
131 file.write("\n");
132 }
133
134 if (destination.isEmpty()) {
135 file.write("# destination = ~/Applications\n");
136 } else {
137 file.write("destination = ");
138 file.write(destination.toUtf8());
139 file.write("\n");
140 }
141
142 if (enableDaemon < 0) {
143 file.write("# enable_daemon = true\n");
144 } else {
145 file.write("enable_daemon = ");
146 if (enableDaemon == 0) {
147 file.write("false");
148 } else {
149 file.write("true");
150 }
151 file.write("\n");
152 }
153
154 file.write("\n\n");
155
156 // daemon configs
157 file.write("[appimagelauncherd]\n");
158
159 if (additionalDirsToWatch.empty()) {
160 file.write("# additional_directories_to_watch = ~/otherApplications:/even/more/applications\n");
161 } else {
162 file.write("additional_directories_to_watch = ");
163 file.write(additionalDirsToWatch.join(':').toUtf8());
164 file.write("\n");
165 }

Callers 2

saveSettingsMethod · 0.85
writeConfigFileMethod · 0.85

Calls 1

getConfigFilePathFunction · 0.85

Tested by

no test coverage detected