ctini 0.1.1

A compile-time INI parser.

To use this package, run the following command in your project's root directory:

Manual usage
Put the following dependency into your project's dependences section:



Simply import ctini.ctini, instantiate IniConfig with the file name of an INI file, and assign it to a variable.

Don't forget to set the include path with th -J option for DMD, or the stringImportPaths setting for dub

See the example below for how to access the settings.


INI file:

;A comment
intValue = 3        #Also a comment
stringValue = "string"
floatvalue	=123.45 ; <-- flexible whitespace
boolValue = false

D file:

import ctini.ctini;

enum config = IniConfig!"config.ini";

void main() {
    //Four data types
    //Everything available at compile time
    static assert(config.Section.intValue == 3);
    static assert(config.Section.stringValue == "string");
    static assert(config.Section.floatValue == 123.45f);
    static assert(config.Section.Subsection.boolValue == false);


  • Variable and section names should follow D identifier rules, and cannot be D keywords.

  • Every variable must be in a section (there must be a section heading before any variables are set).

  • A section cannot have two variables with the same name, but two different sections can have variables with the same name.

  • The final object is a std.typecons.Tuple, and can be used accordingly.

  • Running dub --config=regen will allow you to regenerate the INI grammar, but this should only be necessary if you decide to edit include/INI.peg.


  • Settings without sections
  • Validating against user-defined types (with default values)
  • Single quote strings
  • Nicer errors
  • David Osborne
0.2.1 2014-Feb-22
0.2.0 2014-Feb-21
0.1.1 2014-Jan-28
~master 2019-May-21
Show all 4 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 726 downloads total

Short URL: