1.12.2 How do I put my YAML file outside of the server folder?

Discussion in 'Spigot Plugin Development' started by Sanfeanso, Jun 28, 2020.

  1. Pretty much the title, how can I do it? Very simple question, but still not sure. I'm pretty sure that using "File fileName = new File("C:/Users/User/Desktop/whatever");" wont work, so what will?
     
  2. Someone can correct me if I’m wrong, but I’m pretty sure you can’t. I think it’s built into Spigot that the plugin files are created in the plugins folder.

    Also, don’t do “Desktop/User/etc..” do “Desktop” + File.seperator + “User” + “etc”
     
  3. I know MassiveCraft factions does it, but as far as how I am clueless.
     
  4. Just use Java's io API for creating and managing files. Also try using `\\` instead of `/`.
     
    • Like Like x 1
    • Agree Agree x 1
  5. new File(“”); should return the main server directory from what I’ve seen.
     
  6. Yeah that's definitely not the case
     
    • Funny Funny x 2
  7. You should use File.separator instead, it'll return the separator for the file system java is running on
    '\' is Windows only where as '/' is used in UNIX filesystems
    I know using '/' works on windows, however I don't know about vice-versa
     
  8. I certainly would not recommend this action !

    This type of info can lead to mal-practice for those so inclined to do so.

    Anything related to the Minecraft server should stay in the Minecraft server.

    If a 'USER' wants to access that file, it should be done from outside of a Minecraft server instance and NOT through the Minecraft server.
     
    #9 Goldentoenail, Jun 29, 2020
    Last edited: Jun 29, 2020