package com.fatico.winthing;

import java.io.File;

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;
import com.typesafe.config.ConfigParseOptions;
import com.typesafe.config.ConfigSyntax;

public class ApplicationModule extends AbstractModule {
	public static final String ConfigFile = "winthing.conf";
	
    @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() {
    	Config cfg = ConfigFactory.load();
    	
    	String path = System.getProperty("user.dir") + File.separator + ConfigFile;
    	
    	System.out.println(path);
    	
    	File fp = new File(path);
    	if (fp.exists()) {
    		ConfigParseOptions options = ConfigParseOptions.defaults();
    		options.setSyntax(ConfigSyntax.CONF);
    		
    		cfg = ConfigFactory.parseFile(fp).withFallback(cfg);
    	}
        
        return cfg;
    }
}

@@ -457,16 +457,76 @@
 yntax;%0A%0A
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;%0A%0A
 public c
@@ -767,32 +767,108 @@
 ule());%0A        
+if (System.getProperty(%22os.name%22).toLowerCase().contains(%22win%22)) %7B%0A        %09
 install(new Wind
@@ -881,16 +881,25 @@
 ule());%0A
+        %09
 %0A       
@@ -891,32 +891,33 @@
       %09%0A        
+%09
 install(new com.
@@ -958,32 +958,33 @@
 ule());%0A        
+%09
 install(new com.
@@ -1027,32 +1027,33 @@
 ule());%0A        
+%09
 install(new com.
@@ -1091,24 +1091,34 @@
 .Module());%0A
+        %7D%0A
     %7D%0A%0A    @
@@ -1141,16 +1141,82 @@
 ngleton%0A
+    @SuppressFBWarnings(%22RV_RETURN_VALUE_IGNORED_NO_SIDE_EFFECT%22)%0A
     Conf
@@ -1609,16 +1609,25 @@
 eFile(fp
+, options
 ).withFa

Include Windows modules only when running on Windows platform