如何获取运行 Corona Simulator 的操作系统?
How to get operation system where Corona Simulator is working on?
我只想知道有什么方法可以获取运行 Corona 模拟器的 host 的 OS?
我知道 system.getInfo("environment") == "simulator"
和 system.getInfo("platform")
。
In the Corona Simulator, the value returned depends on the skin
selected, allowing you to test platform-dependent logic by changing
skins.
我正在 Windows 上开发,我的模拟器皮肤设置为 Android 设备,但是 system.getInfo("platform")
我找不到 host os(即Windows)。
我错过了关于您想知道模拟器是否在 Windows、macOS 或其他一些系统上 运行ning 的问题。显然,如您所述,这将为您提供皮肤平台。
system.getInfo()API让你获得平台:
http://docs.coronalabs.com/api/library/system/getInfo.html#platform
这会让你知道你是否在 "android"、"ios"、"win32" 等
只有少数用例您会关心模拟器 运行 正在运行什么。在大多数情况下,您想模拟最终设备。我猜你正在构建一些用户将 运行 在 Windows 或 macOS 上使用的工具。我想你会为 Windows 构建一个 .exe 或一个 macOS 二进制文件并将其分发给任何想要使用它的人。
但是您可以使用"architectureInfo"来获取底层架构信息。如果您在 windows 上,它将 return 类似于 "x86" 或 "x64"。您可以结合查看您是否在模拟器中 运行ning 进行测试:
if system.getInfo( "environment" ) == "simulator" then
if (system.getInfo("architectureInfo") == "x86" or system.getInfo("architectureInfo") == "x64") then
print("This simulator is running on Windows")
elseif (system.getInfo("architectureInfo") == "x86_64" or system.getInfo("architectureInfo") == "i386") then
print("This simulator is running on macOS")
end
end
参见:http://docs.coronalabs.com/api/library/system/getInfo.html#architectureinfo
我只想知道有什么方法可以获取运行 Corona 模拟器的 host 的 OS?
我知道 system.getInfo("environment") == "simulator"
和 system.getInfo("platform")
。
In the Corona Simulator, the value returned depends on the skin selected, allowing you to test platform-dependent logic by changing skins.
我正在 Windows 上开发,我的模拟器皮肤设置为 Android 设备,但是 system.getInfo("platform")
我找不到 host os(即Windows)。
我错过了关于您想知道模拟器是否在 Windows、macOS 或其他一些系统上 运行ning 的问题。显然,如您所述,这将为您提供皮肤平台。
system.getInfo()API让你获得平台:
http://docs.coronalabs.com/api/library/system/getInfo.html#platform
这会让你知道你是否在 "android"、"ios"、"win32" 等
只有少数用例您会关心模拟器 运行 正在运行什么。在大多数情况下,您想模拟最终设备。我猜你正在构建一些用户将 运行 在 Windows 或 macOS 上使用的工具。我想你会为 Windows 构建一个 .exe 或一个 macOS 二进制文件并将其分发给任何想要使用它的人。
但是您可以使用"architectureInfo"来获取底层架构信息。如果您在 windows 上,它将 return 类似于 "x86" 或 "x64"。您可以结合查看您是否在模拟器中 运行ning 进行测试:
if system.getInfo( "environment" ) == "simulator" then
if (system.getInfo("architectureInfo") == "x86" or system.getInfo("architectureInfo") == "x64") then
print("This simulator is running on Windows")
elseif (system.getInfo("architectureInfo") == "x86_64" or system.getInfo("architectureInfo") == "i386") then
print("This simulator is running on macOS")
end
end
参见:http://docs.coronalabs.com/api/library/system/getInfo.html#architectureinfo