Comment 2 for bug 896512

Revision history for this message
Chris McIntosh (gnu-know-who) wrote :

I thought that I'd file a bug (https://bugs.launchpad.net/ubuntu/+source/gnome-desktop/+bug/899882) against the source of this error...

But, it occurred to me (while writing that bug report) that the correct solution would be to change sysinfo to behave like this (source code is listed below):
  1) Currently, the Gnome() method assigns "/usr/share/gnome-about/gnome-version.xml" to the String variable gnome_about. It then changes the value of the string in case there exists a "gnome-version.xml" file in the "/opt/gnome/share/gnome-about/" directory.

PROPOSAL:
  2) A similar change should be made if there exists a "gnome-version.xml" file in the "/usr/share/gnome/" directory. (This file comes from the gnome-desktop3-data package).

Here is the Gnome() method from SystemInfo.cs in the sysinfo package:

  //read GNOME version
  public void Gnome() {

   String temp;
   Boolean gnomeB = false;

   //Fedora,RedHat,Debian,Ubuntu,...
   String gnome_about = "/usr/share/gnome-about/gnome-version.xml";
   //SuSE
   if (File.Exists("/opt/gnome/share/gnome-about/gnome-version.xml"))
    gnome_about = "/opt/gnome/share/gnome-about/gnome-version.xml";

   try {

    using (TextReader textread = File.OpenText(gnome_about)) {

     while ( gnomeB == false ) {

      temp = textread.ReadLine();

      //get version from xml
      if ( temp.EndsWith("platform>")) {

       temp = temp.Remove(0, 12);
       temp = temp.Remove(temp.IndexOf("</platform>"), 11);
       system_gnomev = temp;
      }

      if ( temp.EndsWith("minor>")) {

       temp = temp.Remove(0, 9);
       temp = temp.Remove(temp.IndexOf("</minor>"), 8);
       system_gnomev = system_gnomev + "." + temp;
      }

      if ( temp.EndsWith("micro>")) {

       temp = temp.Remove(0, 9);
       temp = temp.Remove(temp.IndexOf("</micro>"), 8);
       system_gnomev = system_gnomev + "." + temp;
      }

      //get distributor
      if ( temp.EndsWith("distributor>")) {

       temp = temp.Remove(0, 15);
       temp = temp.Remove(temp.IndexOf("</distributor>"), 14);
       system_gnomeo = temp;
      }

      //get build date
      if ( temp.EndsWith("date>")) {

       temp = temp.Remove(0, 8);
       temp = temp.Remove(temp.IndexOf("</date>"), 7);
       system_gnomeo = system_gnomeo + " " + temp;

       gnomeB = true;
      }

     }

    }

   }
   catch (FileNotFoundException ex) { Console.WriteLine( ex ); }
   catch (DirectoryNotFoundException ex) { Console.WriteLine( ex ); }
  }