opentyrian / need-data.sh

Alexandre Detiste alexandre.detiste at gmail.com
Sun Apr 5 11:12:23 UTC 2015


Hi,

Here is my rewrite of need-data.sh into C code for OpenTyrian package.
(I also included notify-send in the mix).

This first need that this pull request is approved
https://bitbucket.org/a-detiste/opentyrian/commits/12c763dc1ca049825e928a8a417812d55c44bcf9

I will then propose this to upstream, with
"These can be installed using game-data-packager.\n"
changed to generic
"Please read the README file.\n"



diff -r 12c763dc1ca0 src/varz.c
--- a/src/varz.c	Sun Apr 05 11:29:52 2015 +0200
+++ b/src/varz.c	Sun Apr 05 13:03:59 2015 +0200
@@ -16,6 +16,10 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
  */
+#ifdef TARGET_UNIX
+#include <unistd.h>
+#endif
+
 #include "config.h"
 #include "editship.h"
 #include "episodes.h"
@@ -498,6 +502,38 @@
 	}
 
 	SDL_Quit();
+
+#ifdef TARGET_UNIX
+#define MISSING_TEXT "One or more of the required Tyrian " TYRIAN_VERSION " data files could not be found.\n" \
+                     "These can be installed using game-data-packager.\n"
+	if (code == 1)
+	{
+		char* argv[6];
+		pid_t child_pid;
+		child_pid = fork();
+		if(child_pid == 0) {
+			argv[0] = "zenity";
+			argv[1] = "--error";
+			argv[2] = "--text=" MISSING_TEXT;
+			argv[3] = "--title=Tyrian";
+			argv[4] = NULL;
+			execvp(argv[0], argv);
+			argv[0] = "kdialog";
+			argv[2] = MISSING_TEXT;
+			execvp(argv[0], argv);
+			argv[0] = "xmessage";
+			argv[1] = "-center";
+			argv[3] = NULL;
+			execvp(argv[0], argv);
+			argv[0] = "notify-send";
+			argv[1] = "Tyrian";
+			argv[3] = "-i";
+			argv[4] = "dialog-error";
+			argv[5] = NULL;
+			execvp(argv[0], argv);
+		}
+	}
+#endif
 	exit(code);
 }
 




More information about the Pkg-games-devel mailing list