This repository has been archived by the owner on Mar 4, 2022. It is now read-only.
forked from tModLoader/tModLoader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LinuxInfo.java
53 lines (47 loc) · 1.66 KB
/
LinuxInfo.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import java.io.File;
public class LinuxInfo {
public static void main(String[] args) {
String[] files = new String[]
{
"tModLoader.exe",
"tModLoaderServer.exe",
"tModLoaderServer",
"Terraria",
"tModLoader",
"tModLoader-kick",
"tModLoader-mono",
"I18N.dll",
"I18N.West.dll"
};
String[] filesToDelete = new String[]
{
"Terraria.exe.config",
"MP3Sharp.dll",
"Ionic.Zip.Reduced.dll",
"Mono.Cecil.dll"
};
Installer.tryInstall(files, filesToDelete, getInstallDir(), false);
}
private static File getInstallDir() {
File installDir;
String xdgHome = System.getenv("XDG_DATA_HOME");
if (xdgHome != null) {
installDir = new File(xdgHome + "/Steam/steamapps/common/Terraria");
if (installDir.isDirectory()) {
return installDir;
}
}
String home = System.getenv("HOME");
if (home != null) {
installDir = new File(home + "/.local/share/Steam/steamapps/common/Terraria");
if (installDir.isDirectory()) {
return installDir;
}
installDir = new File(home + "/.steam/steam/steamapps/common/Terraria");
if (installDir.isDirectory()) {
return installDir;
}
}
return null;
}
}