Jump to content

Config file in wrong spot?


DarkGuardsman

Recommended Posts

This is not a big deal but all the mods i have keep dumping there config file onto my desktop. For most this wouldn't be an issue but my desktop get randomly cleaned after I've piled too much files, folder and links on it. For some reason though a few mods actual end up in the right config file  and I've figured out why. Before anyone says i've not tested much i've tested on 4 pcs with all the same effect

 

This code will cause the config file too end up in the wrong spot, or rather where ever the program that launches minecraft is at that time. For example the .bat file i use for error testing is on my desktop. Moving the .bat file around does cause a new config file to generate. Same for my minecraft.exe launcher.

static Configuration config = new Configuration((new File("config/EUIndustry/SteamPower.cfg")));

this will end up in the config folder in .minecraft directory.

static

Configuration config = new Configuration((new File(Minecraft.getMinecraftDir(), "config/EUIndustry/SteamPower.cfg")));

The issue is this only works Client side and since mods are both client and server this can cause issues. Mainly since Minecraft.getMinecraftDir() from off the top of my head doesn't excist server side. So what i'm asking what can i do to make sure the configs for my mods ends up in the right spot without using Minecraft.getMinecraftDir().

Link to comment
Share on other sites

Here is what I'm using, it places a modname.cfg into the config folder.

with a bit of string manipulation you can add "/EUIndustry/" and change the file name if you wish.

 

@PreInit
public void preInit(FMLPreInitializationEvent event)
{
    configFile = event.getSuggestedConfigurationFile();

 

 

Link to comment
Share on other sites

I would suggest using the preinit event method. It will *always* be right and canonical too.. the desktop thing is likely a bad launcher not injecting a folder path correctly...

could be i guess i might need to update my .bat files so they link the path names right. Still a bit odd though seeing as this never happened before 1.3 update. Then again in 1.2.5 people had minecraft.getDir() in the client side of their mod.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.