代码拉取完成,页面将自动刷新
//xlang Source, Name:XPlatform.xcsm
//Date: Thu Jan 18:45:18 2019
class XPlatform{
static String [] os_names = {"Windows", "Linux", "MaxOSX", "Unknow"};
static String [] arch_names = {"Unknow", "x86", "x86_64", "arm", "arm64", "mips", "mips64"};
public static String getOSName(){
return os_names[_system_.getPlatformId()];
}
public static String getArchName(){
return arch_names[_system_.getArchId()];
}
public @NotNilptr static String converPlatformCharSetTo(@NotNilptr String filepath){
String original_path = filepath;
if (_system_.getPlatformId() == 0){
// windows 下要转成CP936
try{
original_path = new String(filepath.getBytes(), "CP936");
}catch(Exception e){
original_path = filepath;
}
}
return original_path;
}
public @NotNilptr static String converToPlatformCharSet(@NotNilptr String filepath){
String original_path = filepath;
if (_system_.getPlatformId() == 0){
// windows 下要转成CP936
try{
original_path = new String(filepath.getBytes("CP936"));
}catch(Exception e){
original_path = filepath;
}
}
return original_path;
}
public @NotNilptr static String getAppDirectory(){
return converPlatformCharSetTo(_system_.getAppDirectory());
}
public static long SystemFileSize(@NotNilptr String filepath){
String original_path = converToPlatformCharSet(filepath);
return _system_.getFileSize(original_path);
}
public static bool chmodSystemFile(@NotNilptr String filepath, int mode){
String original_path = converToPlatformCharSet(filepath);
return _system_.chmod(original_path, mode);
}
public static long openSystemFile(@NotNilptr String filepath,@NotNilptr String mode){
String original_path = converToPlatformCharSet(filepath);
return _system_.openFile(original_path, mode);
}
public static bool renameFile(@NotNilptr String oldfile,@NotNilptr String newfile){
String old_file = converToPlatformCharSet(oldfile);
String new_file = converToPlatformCharSet(newfile);
return _system_.rename(old_file, new_file);
}
public static bool existsSystemFile(@NotNilptr String filepath){
String original_path = converToPlatformCharSet(filepath);
return _system_.fileExists(original_path);
}
public static bool mkdir(@NotNilptr String filepath){
String original_path = converToPlatformCharSet(filepath);
return _system_.mkdir(original_path);
}
public static bool deleteFile(@NotNilptr String filepath){
String original_path = converToPlatformCharSet(filepath);
return _system_.deleteFile(original_path);
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。