Solved Get Server Root Folder

Discussion in 'Plugin Development' started by PogoStick29, Feb 27, 2013.

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

    PogoStick29

    Very simple request: I need to get the path of the server's root folder so I can get an instance of it in the File class, like File root = new File("path");
     
  2. Offline

    Rprrr

    Code:
            this.getDataFolder().getAbsolutePath();
    Not 100% sure if that's it.
     
  3. Offline

    PogoStick29

    getDataFolder() returns the folder for your plugin in the plugins folder (/plugin/PluginName/)

    I need the base directory.
     
  4. Offline

    Rprrr

    PogoStick29
    Perhaps this is it.
    Code:
    plugin.getServer().getWorldContainer().getAbsolutePath()
     
  5. Offline

    Tirelessly

    getDataFolder().getCanonicalPath().split()

    In that split come up with some way to get the third to last section.
     
  6. Offline

    PogoStick29

    This appears to work!
     
  7. Offline

    ferrybig

    remember that if the world container folder is changed it wont work, as far I think this is the best solution:
    new File(".").getAbsolutePath()
    as the working directory is the server directory
     
    El_Chupe, Xeiotos and PogoStick29 like this.
Thread Status:
Not open for further replies.

Share This Page