May 06, 2014
On 05/06/2014 03:16 AM, Suliman wrote:

> When I had create instance of class in main, and create confvarible
> above it all worked, but when I had moved it's in module I got error.

There is module 'static this()' for such runtime initialization:

Config config;

static this()
{
    config = new Config(confname);
    if (config.isconfigexists())
        writeln("config exist");
    else
        writeln("config do not exists");
}

void main()
{}

Ali

May 06, 2014
Thanks! But is there any other solution? I am thinking that I am trying to specify config name by wrong way...
May 06, 2014
On 05/06/2014 07:40 AM, Suliman wrote:
> Thanks! But is there any other solution? I am thinking that I am trying
> to specify config name by wrong way...

Sorry, I don't understand what exactly you are trying to do. :( Is config file a compile-time concept? Do you want to read it at compile time?

You can also include the contents of a file at compile-time:

   import ("somefile.d")

The compiler will read the file and insert its contents where the import statement appears.

On the other hand, if it is available only at run-time, you obviously have to read it at run time.

Ali

May 06, 2014
I am tying to hardcode name of config file name. Then I would read and parse it.
1 2
Next ›   Last »