package com.fatico.winthing;

import com.fatico.winthing.messaging.MessagingModule;
import com.fatico.winthing.windows.WindowsModule;

import com.google.gson.Gson;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.Singleton;
import com.typesafe.config.Config;
import com.typesafe.config.ConfigFactory;

public class ApplicationModule extends AbstractModule {

    @Override
    protected void configure() {
        bind(Gson.class).in(Singleton.class);

        install(new MessagingModule());
        install(new WindowsModule());

        install(new com.fatico.winthing.systems.system.Module());
        install(new com.fatico.winthing.systems.keyboard.Module());
        install(new com.fatico.winthing.systems.desktop.Module());
    }

    @Provides
    @Singleton
    Config config() {
        return ConfigFactory.load();
    }

}

@@ -23,16 +23,38 @@
 thing;%0A%0A
+import java.io.File;%0A%0A
 import c
@@ -372,65 +372,212 @@
 ry;%0A
-%0Apublic class ApplicationModule extends AbstractModule %7B%0A
+import com.typesafe.config.ConfigParseOptions;%0Aimport com.typesafe.config.ConfigSyntax;%0A%0Apublic class ApplicationModule extends AbstractModule %7B%0A%09public static final String ConfigFile = %22winthing.conf%22;%0A%09
 %0A   
@@ -1013,46 +1013,445 @@
     
-    return ConfigFactory.load(
+%09Config cfg = ConfigFactory.load();%0A    %09%0A    %09String path = System.getProperty(%22user.dir%22) + File.separator + ConfigFile;%0A    %09%0A    %09System.out.println(path);%0A    %09%0A    %09File fp = new File(path);%0A    %09if (fp.exists()) %7B%0A    %09%09ConfigParseOptions options = ConfigParseOptions.defaults();%0A    %09%09options.setSyntax(ConfigSyntax.CONF);%0A    %09%09%0A    %09%09cfg = ConfigFactory.parseFile(fp).withFallback(cfg
 );%0A    
+%09
 %7D%0A
+        %0A        return cfg;%0A    %7D
 %0A%7D%0A

read settings from file in the working directory