Removed Path API usage

This commit is contained in:
Anuken
2019-12-15 21:12:41 -05:00
parent 0cf39bf5c3
commit e9ed0512f7
4 changed files with 87 additions and 115 deletions

View File

@@ -7,8 +7,6 @@ import io.anuke.arc.files.*;
import io.anuke.arc.util.*;
import io.anuke.arc.util.io.*;
import java.io.*;
public class Version{
/** Build type. 'official' for official releases; 'custom' or 'bleeding edge' are also used. */
public static String type;
@@ -26,29 +24,25 @@ public class Version{
public static void init(){
if(!enabled) return;
try{
Fi file = OS.isAndroid || OS.isIos ? Core.files.internal("version.properties") : new Fi("version.properties", FileType.Internal);
Fi file = OS.isAndroid || OS.isIos ? Core.files.internal("version.properties") : new Fi("version.properties", FileType.Internal);
ObjectMap<String, String> map = new ObjectMap<>();
PropertiesUtils.load(map, file.reader());
ObjectMap<String, String> map = new ObjectMap<>();
PropertiesUtils.load(map, file.reader());
type = map.get("type");
number = Integer.parseInt(map.get("number", "4"));
modifier = map.get("modifier");
if(map.get("build").contains(".")){
String[] split = map.get("build").split("\\.");
try{
build = Integer.parseInt(split[0]);
revision = Integer.parseInt(split[1]);
}catch(Throwable e){
e.printStackTrace();
build = -1;
}
}else{
build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1;
type = map.get("type");
number = Integer.parseInt(map.get("number", "4"));
modifier = map.get("modifier");
if(map.get("build").contains(".")){
String[] split = map.get("build").split("\\.");
try{
build = Integer.parseInt(split[0]);
revision = Integer.parseInt(split[1]);
}catch(Throwable e){
e.printStackTrace();
build = -1;
}
}catch(IOException e){
throw new RuntimeException(e);
}else{
build = Strings.canParseInt(map.get("build")) ? Integer.parseInt(map.get("build")) : -1;
}
}
}