Skip to content

Commit

Permalink
Drop file injection support (#3125)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImMorpheus authored Aug 23, 2020
1 parent b7e2bfd commit 97ef12f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 92 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.spongepowered.api.config.ConfigDir;
import org.spongepowered.common.SpongeCommon;
import org.spongepowered.common.inject.provider.ConfigDirAnnotation;
import org.spongepowered.common.inject.provider.PathAsFileProvider;

import java.io.File;
import java.nio.file.Path;
Expand All @@ -40,12 +39,6 @@ public final class SpongeModule extends AbstractModule {
@Override
protected void configure() {
this.bind(Path.class).annotatedWith(ConfigDirAnnotation.SHARED).toInstance(SpongeCommon.getPluginConfigDirectory());
this.bind(File.class).annotatedWith(ConfigDirAnnotation.SHARED).toProvider(new PathAsFileProvider() {
@Inject
void init(@ConfigDir(sharedRoot = true) Provider<Path> path) {
this.path = path;
}
});
}

}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ public final class PluginConfigurationModule extends AbstractModule {
@Override
protected void configure() {
this.bind(Path.class).annotatedWith(ConfigDirAnnotation.NON_SHARED).toProvider(NonSharedDirAsPath.class);
this.bind(File.class).annotatedWith(ConfigDirAnnotation.NON_SHARED).toProvider(NonSharedDirAsFile.class);
// Plugin-private directory config file
this.bind(Path.class).annotatedWith(DefaultConfigAnnotation.NON_SHARED).toProvider(NonSharedPathAsPath.class);
this.bind(File.class).annotatedWith(DefaultConfigAnnotation.NON_SHARED).toProvider(NonSharedPathAsFile.class);
// Shared-directory config file
this.bind(Path.class).annotatedWith(DefaultConfigAnnotation.SHARED).toProvider(SharedDirAsPath.class);
this.bind(File.class).annotatedWith(DefaultConfigAnnotation.SHARED).toProvider(SharedDirAsFile.class);
// Loader for shared-directory config file
this.bind(COMMENTED_CONFIGURATION_NODE_LOADER).annotatedWith(DefaultConfigAnnotation.SHARED).toProvider(SharedCommentedConfigurationNode.class);
// Loader for plugin-private directory config file
Expand All @@ -78,20 +75,6 @@ public Path get() {

}

/**
* Provides a non-shared (private) directory.
*
* {@literal @}ConfigDir(sharedRoot = false) File configDir;
*/
public static class NonSharedDirAsFile extends PathAsFileProvider {

@Inject
void init(@ConfigDir(sharedRoot = false) Provider<Path> path) {
this.path = path;
}

}

/**
* Provides a configuration path within a non-shared (private) directory.
*
Expand All @@ -108,20 +91,6 @@ public Path get() {

}

/**
* Provides a configuration file within a non-shared (private) directory.
*
* {@literal @}DefaultConfig(sharedRoot = false) File configFile;
*/
public static class NonSharedPathAsFile extends PathAsFileProvider {

@Inject
void init(@DefaultConfig(sharedRoot = false) Provider<Path> path) {
this.path = path;
}

}

/**
* Provides a configuration path within a shared directory.
*
Expand All @@ -138,20 +107,6 @@ public Path get() {

}

/**
* Provides a configuration file within a shared directory.
*
* {@literal @}DefaultConfig(sharedRoot = true) File configFile;
*/
static class SharedDirAsFile extends PathAsFileProvider {

@Inject
void init(@DefaultConfig(sharedRoot = true) Provider<Path> path) {
this.path = path;
}

}

static abstract class CommentedConfigurationNodeProvider implements Provider<ConfigurationLoader<CommentedConfigurationNode>> {

@Inject protected PluginContainer container;
Expand Down

0 comments on commit 97ef12f

Please sign in to comment.