Skip to content

Commit fc8149a

Browse files
committed
Fix remove action
1 parent 957de54 commit fc8149a

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

AppAdder/mainwindow.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@ std::string getFilePath(std::string path) {
3838
}
3939

4040
// 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-
41+
void writeData(std::string data, std::string path) {
4542
std::ofstream file(path);
4643
file << data;
4744

@@ -137,11 +134,15 @@ void MainWindow::on_createButton_clicked() {
137134
fileContents += "Type=Application\n";
138135
fileContents += "Icon=" + copyFileName + "\n"; // Icon=/home/jason/.icons/app.png
139136
fileContents += "\nTryExec=" + copyToLocation + "\n"; // TryExec=/home/jason/Applications/app.AppImage
137+
fileContents += "Actions=Remove;\n";
140138

141139
fileContents += "\n[Desktop Action Remove]\n";
142140
fileContents += "Name=Uninstall app from system\n";
143-
fileContents += "Exec=rm " + copyToLocation + " " + imageCopyLocation + "\n";
144141

145-
writeData(fileContents, name.toUtf8().constData());
142+
std::string desktopFilePath = homedir;
143+
desktopFilePath += "/.local/share/applications/" + (std::string) name.toUtf8().constData() + ".desktop";
144+
fileContents += "Exec=rm " + copyToLocation + " " + imageCopyLocation + " " + desktopFilePath + "\n";
145+
146+
writeData(fileContents, desktopFilePath);
146147
}
147148

0 commit comments

Comments
 (0)