Skip to content

Commit

Permalink
Old TFCOptions.cfg file will be deleted when first creating the new T…
Browse files Browse the repository at this point in the history
…FCConfig.cfg file
  • Loading branch information
Kittychanley committed Jul 29, 2015
1 parent dc35cc1 commit 62276c3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Common/com/bioxx/tfc/Core/TFC_ConfigGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class TFC_ConfigGUI extends GuiConfig
{
public TFC_ConfigGUI(GuiScreen parent)
{
super(parent, getConfigElements(), Reference.ModID, false, false, "TFCOptions.cfg");
super(parent, getConfigElements(), Reference.ModID, false, false, "TFCConfig.cfg");
}

/** Compiles a list of config elements */
Expand Down
12 changes: 11 additions & 1 deletion src/Common/com/bioxx/tfc/TerraFirmaCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,17 @@ public void preInit(FMLPreInitializationEvent event)
//Load our settings from the TFCOptions file
try
{
config = new Configuration(new File(TerraFirmaCraft.proxy.getMinecraftDir(), "/config/TFCConfig.cfg"));
File newConfig = new File(TerraFirmaCraft.proxy.getMinecraftDir(), "/config/TFCConfig.cfg");
// If we are creating the new config for the first time, delete the old config file to help prevent confusion of having two similar files.
if (!newConfig.exists())
{
File oldConfig = new File(TerraFirmaCraft.proxy.getMinecraftDir(), "/config/TFCOptions.cfg");
if (oldConfig.exists() && !oldConfig.isDirectory())
{
oldConfig.delete();
}
}
config = new Configuration(newConfig);
config.load();
} catch (Exception e)
{
Expand Down

3 comments on commit 62276c3

@CHeuberger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if deleting is such a good idea...if there is no backup it could be hard to see how the settings were. Maybe just rename it so its obvious that it is not being used anymore and avoid confusion...

@Kittychanley
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our config files are very simple. There is an extremely low chance that you won't remember the important ones like year length. There are also going to be huge red warnings on the homepage post, change log, and download page warning that the old file is going to be deleted, and that you should take note of what your settings were. If we rename the file, I can 100% guarantee there's just going to be players who edit that renamed file trying to change configs, and then complain that the change isn't saving.

@CHeuberger
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's why I suggested it being renamed - if someone edits a file named like "options.bak" or even better "OLDoptions.bak" thinking it is the actual one, well... you cannot avoid EVERY possible 'trouble'.
But deleting the options file (not to recycle bin, if I'm correct) is a bit more 'dangerous' as trying to change settings in the wrong file with no impact (despite of a bad mood).
Just my 2 cents . . .

Please sign in to comment.