Jump to content
Frequently Asked Questions
  • Are you not able to open the client? Try following our getting started guide
  • Still not working? Try downloading and running JarFix
  • Help! My bot doesn't do anything! Enable fresh start in client settings and restart the client
  • How to purchase with PayPal/OSRS/Crypto gold? You can purchase vouchers from other users
  • Could someone with Mac knowledge chime in?


    Genius

    Recommended Posts

    I'm making a save/load preferences feature on one of my scripts, and want to make it compatible with Mac machines as well.

     String path = ("C:\\Users\\" + System.getProperty("user.name") + "\\DreamBot\\Genius Scripts\\");
    ^This will only work on windows, of course.
     
    The full snippet creates the directory if it doesn't exist, and saves a preferences text file that the "load" part of the snippet reads to fetch user settings.
     
    Since I'd like it to work with Mac machines as well, I would need someone with a Mac to tell me the "DreamBot" folders path on their machine.
     
    I read something about "~" is the C drive equivalent? Any help would be greatly appreciated.
    Link to comment
    Share on other sites

     

    I'm making a save/load preferences feature on one of my scripts, and want to make it compatible with Mac machines as well.

     String path = ("C:\\Users\\" + System.getProperty("user.name") + "\\DreamBot\\Genius Scripts\\");
    ^This will only work on windows, of course.
     
    The full snippet creates the directory if it doesn't exist, and saves a preferences text file that the "load" part of the snippet reads to fetch user settings.
     
    Since I'd like it to work with Mac machines as well, I would need someone with a Mac to tell me the "DreamBot" folders path on their machine.
     
    I read something about "~" is the C drive equivalent? Any help would be greatly appreciated.

     

     

    You can use this. It will work on mac, linux and windows

    // this returns "C:\Users\YOUR_USER\DreamBot" or the equivalent in other operating systems
    public static String getStorageDirectory(){
       return System.getProperty("scripts.path").replace(File.separator + "Scripts","");
    }
    
    Link to comment
    Share on other sites

     

    You can use this. It will work on mac, linux and windows

    // this returns "C:\Users\YOUR_USER\DreamBot" or the equivalent in other operating systems
    public static String getStorageDirectory(){
       return System.getProperty("scripts.path").replace(File.separator + "Scripts","");
    }
    

     

    Ahhhh I didn't know something so simple existed! Thanks a lot Neffarion!!

    Link to comment
    Share on other sites

    Archived

    This topic is now archived and is closed to further replies.

    ×
    ×
    • Create New...

    Important Information

    We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.