Rename path in a configuration file

Discussion in 'Plugin Development' started by thescreem, Aug 8, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    thescreem

    This seems like a pretty straight-forward thing, but I couldn't find anything about it.

    Say I have a config file like this:

    Code:
    path:
        goes:
            here: String
            and-here: 20
            also-here: true
    How would I rename "path.goes" to "path.renamed", without affecting any of the keys under "goes"? (And I mean in code form, I know I can open the file and rename that way)

    Thanks in advance for any help.
    - Screem :)
     
  2. Offline

    thescreem

    Any help? It's been a day and nobody posted. :(
     
  3. Offline

    stelar7

    Code:
    for (String s : config.getConfigurationSelection("path.goes").getKeys(false)) {
        config.set("path.renamed."+s, config.get("path.goes."+s));
    }
     
  4. Offline

    thescreem

    Thanks! :)
     
Thread Status:
Not open for further replies.

Share This Page