Skip to content

Commit e70534b

Browse files
committed
Setup .desktop file creation
1 parent c9188d0 commit e70534b

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

AppAdder/mainwindow.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ std::string getFilePath(std::string path) {
3737
return path;
3838
}
3939

40+
// Writes data to the .desktop file
41+
void writeData(std::string data, std::string name) {
42+
std::string path = homedir;
43+
path += "/.local/share/applications/" + name + ".desktop";
44+
45+
std::ofstream file(path);
46+
file << data;
47+
48+
file.close();
49+
}
50+
4051

4152
MainWindow::~MainWindow() {
4253
delete ui;
@@ -130,5 +141,7 @@ void MainWindow::on_createButton_clicked() {
130141
fileContents += "\n[Desktop Action Remove]\n";
131142
fileContents += "Name=Uninstall app from system\n";
132143
fileContents += "Exec=rm " + copyToLocation + " " + imageCopyLocation + "\n";
144+
145+
writeData(fileContents, name.toUtf8().constData());
133146
}
134147

0 commit comments

Comments
 (0)