I have created a program to download a file and put it in a specific location but I cant get it to work on all systems. What could i change this to to make it work on all operating systems. /Users/anthonybuttillo/Library/Application Support/minecraft/mods/Enderized.zip
Asked
Active
Viewed 59 times
-1
-
1What do you mean by *ALL OSs*? There's quite a few out there... Simply put, you can't. – m0skit0 Dec 10 '12 at 23:17
-
Do you mean this "specific location" for each OS? – jmrodrigg Dec 10 '12 at 23:20
-
@m0skit0 I'd like it to work on windows and mac. – Kyrptonaught Dec 10 '12 at 23:50
-
Windows and Mac is not "all OSes". That's _two_ OSes. – John Saunders Dec 11 '12 at 02:01
1 Answers
0
The issue in this specific case (a Minecraft mod) is relatively simple because the place where a Minecraft installation resides is standardized. As can be read here the Minecraft installation folder is
- Windows Vista/7: C:\Users\YourUserName\AppData\Roaming\.minecraft
- Windows XP: C:\Documents and Settings\YourUserName\Application Data\.minecraft (note - both Windows variations can be found through the
APPDATA
environment variable) - Linux: /home/Your User Name/.minecraft
- Mac OS/X: ~/Library/Application Support/minecraft
So, just detect the OS and starting from the user's home directory ( String s1 = System.getProperty("user.home", ".");
in Java ) you can build the required path.

fvu
- 32,488
- 6
- 61
- 79