[Vala] static string variable is empty!



Hello everybody!
I'm a newbie to vala language, I faced to a strange problem recently and
couldn't find any help in vala documentations.
In my app, I have declared a class named "Global" in a file "global.vala":

using GLib;
public class MyApp.Global : GLib.Object {
    public static string dataDir = "/usr/local/share/";
}

And I have a "main.vala" file, whith this code inside:

using GLib;
using Gtk;
public class MyApp.MainWindow : Window {
   static int main (string[] args) {
      stdout.printf ("all data is in: " + Global.dataDir);
      return 0;
   }
}

After compilation, I get this string in terminal:
all data is in:

Seems that Global.dataDir is empty. Where is my mistake?
Thanks.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]