话不多说直接上代码
使用这个函数就可以判断了,比如
Ruby:
def os_family
os = "other"
case RUBY_PLATFORM
when /ix/i, /ux/i, /gnu/i,/sysv/i, /solaris/i,/sunos/i, /bsd/i
os = "unix"
when /win/i, /ming/i
os = "windows"
end
return os
end
Ruby:
def checkOS
if os_family!="windows"
pbMessage("非windows系统,退出游戏。")
exit(0)
end
end