Ejemplo n.º 1
0
bool showMessage(std::string warning,string writepath) {
	bool guiMessage = false;
	const char * dialogCommand = getDialogCommand();
	if (dialogCommand) {
		std::string command = dialogCommand;

		string text_file = writepath + "/mg_dialog_text.txt";
		{
			FILE *fp = fopen(text_file.c_str(),"wt");
			if (fp != NULL) {
				fputs(warning.c_str(),fp);
				fclose(fp);
			}
		}

		//command += " --title \"Error\" --msgbox \"`printf \"" + warning + "\"`\"";
		command += " --title \"Error\" --text-info --filename=" + text_file;

		//printf("\n\n\nzenity command [%s]\n\n\n",command.c_str());

		FILE *fp = popen(command.c_str(),"r");
		if (fp != 0) {
			guiMessage = true;
			pclose(fp);
		}
	}

	return guiMessage;
}
Ejemplo n.º 2
0
void OSystem::error(const std::string& title, const std::string& text)
{
#if defined(CAESARIA_PLATFORM_LINUX)
  const char * dialogCommand = getDialogCommand();
  if (dialogCommand)
  {
    std::string command = dialogCommand;
    command += " --title \"" + title + "\" --msgbox \"" + text + "\"";
    ::system(command.c_str());
  }

  // fail-safe method here, using stdio perhaps, depends on your application
#elif defined(CAESARIA_PLATFORM_WIN)
  MessageBox(NULL, text.c_str(), title.c_str(), MB_OK | MB_ICONERROR);
#endif
}