File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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 += " \n TryExec=" + 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
You can’t perform that action at this time.
0 commit comments