0 Star 2 Fork 1

Cadaqs/XStudio

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Variable.xcsm 3.51 KB
一键复制 编辑 原始数据 按行查看 历史
Cadaqs 提交于 2021-04-10 02:39 +08:00 . 1.0.18.10130
class Variables
: Map<String, String>{
static Variables _appVariable = new Variables();
public Variables(){
initSystemVar();
}
public void reset(){
super.clear();
}
public void setVariable(String key, String value){
super.put(key, value);
}
public void setSystemVariable(String key, String value){
_appVariable.setVariable(key, value);
}
public String getVariable(String key){
if (containsKey(key)){
return get(key);
}
try{
return _appVariable.get(key);
}catch(Exception e){
}
return "";
}
public @NotNilptr static String MapVariable(@NotNilptr String text){
return _appVariable.map_variable(text);
}
public @NotNilptr String map_variable(@NotNilptr String text){
for (Map.Iterator<String, String> iter = iterator(); iter.hasNext(); iter.next()){
text = text.replace(iter.getKey(), iter.getValue());
}
if (this != _appVariable){
return _appVariable.map_variable(text);
}
return text;
}
public void initSystemVar(){
int osid = _system_.getPlatformId();
String uname_s = "";
String arch = "";
switch(osid){
case _system_.PLATFORM_WINDOWS:
uname_s = "Windows";
break;
case _system_.PLATFORM_LINUX:
uname_s = "Linux";
break;
case _system_.PLATFORM_MACOSX:
uname_s = "MacOSX";
break;
case _system_.PLATFORM_UNIX:
uname_s = "Unix";
break;
case _system_.PLATFORM_ANDROID:
uname_s = "Android";
break;
}
String [] archs = {"unknow", "x86", "x64", "arm", "arm64", "mips", "mips64"};
int archid = _system_.getArchId();
arch = archs[archid];
setVariable("$(uname_s)", uname_s);
setVariable("$(arch)", arch);
setVariable("$(XStudioRoot)", XPlatform.getAppDirectory());
int platformId = _system_.getPlatformId();
if (platformId == _system_.PLATFORM_WINDOWS){
setVariable("$(ExecuteExt)", ".exe");
setVariable("$(SharedExt)", ".dll");
setVariable("$(StaticExt)", ".lib");
setVariable("$(DriverExt)", ".sys");
}else
if (platformId == _system_.PLATFORM_LINUX){
setVariable("$(ExecuteExt)", "");
setVariable("$(SharedExt)", ".so");
setVariable("$(StaticExt)", ".a");
setVariable("$(DriverExt)", ".ko");
}else
if (platformId == _system_.PLATFORM_MACOSX){
setVariable("$(ExecuteExt)", "");
setVariable("$(SharedExt)", ".dylib");
setVariable("$(StaticExt)", ".a");
setVariable("$(DriverExt)", ".");
}
setVariable("$(Windows_ExecuteExt)", ".exe");
setVariable("$(Windows_SharedExt)", ".dll");
setVariable("$(Windows_StaticExt)", ".lib");
setVariable("$(Windows_DriverExt)", ".sys");
setVariable("$(Linux_ExecuteExt)", "");
setVariable("$(Linux_SharedExt)", ".so");
setVariable("$(Linux_StaticExt)", ".a");
setVariable("$(Linux_DriverExt)", ".ko");
setVariable("$(MacOSX_ExecuteExt)", "");
setVariable("$(MacOSX_SharedExt)", ".dylib");
setVariable("$(MacOSX_StaticExt)", ".a");
setVariable("$(MacOSX_DriverExt)", ".");
}
};
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/ixlang/XStudio.git
[email protected]:ixlang/XStudio.git
ixlang
XStudio
XStudio
master

搜索帮助