Solved Folders

Discussion in 'Spigot Plugin Development' started by KDTemperor, Apr 13, 2017.

  1. Hey guys :), can you give me a way on how to create folders for config files?
    I should do it this way <plugin name>/database/<some config files>.yml
     
  2. Code (Java):

    //'getDataFolder()' method is from your main class
    File folder = new File(getDataFolder(), "database");
    //Create the folder
    folder.mkdirs();
     
    Then if you want to create a file in that folder:
    Code (Java):

    //Using the folder we created before
    File file = new File(folder, "config.yml");
    //Or just specifying the path
    File file = new File(getDataFolder() + File.separator + "database", "config.yml");
     
     
    • Agree Agree x 3
  3. thanks for the guide/tutorial/etc. (idk what is it xD)