Merge branch 'master' of github.com:MightyPirates/OpenComputers into master-MC1.7.10

Conflicts:
	src/main/scala/li/cil/oc/util/LuaStateFactory.scala
This commit is contained in:
Florian Nücke 2014-08-19 21:57:04 +02:00
commit e4e161552d
4 changed files with 26 additions and 4 deletions

View File

@ -247,6 +247,18 @@ opencomputers {
# capitalization, which is commonly the case on Windows, for example.
# This only takes effect when bufferChanges is set to true.
forceCaseInsensitiveFS: false
# Logs the full error when a native library fails to load. This is
# disabled by default to avoid spamming the log, since libraries are
# iterated until one works, so it's very likely for some to fail. Use
# this in case all libraries fail to load even though you'd expect one
# to work.
logFullNativeLibLoadErrors: false
# Force loading one specific library, to avoid trying to load any
# others. Use this if you get warnings in the log or are told to do
# so for debugging purposes ;-)
forceNativeLibWithName: ""
}
}

View File

@ -143,6 +143,8 @@ do
computer.pushSignal("init") -- so libs know components are initialized.
status("Starting shell...")
require("term").clear()
os.sleep(0.1) -- Allow init processing.
end
local function motd()
@ -161,7 +163,6 @@ local function motd()
end
while true do
require("term").clear()
motd()
local result, reason = os.execute(os.getenv("SHELL"))
if not result then
@ -170,4 +171,5 @@ while true do
os.sleep(0.5)
require("event").pull("key")
end
require("term").clear()
end

View File

@ -75,6 +75,8 @@ class Settings(config: Config) {
val allowPersistence = !config.getBoolean("computer.debug.disablePersistence")
val limitMemory = !config.getBoolean("computer.debug.disableMemoryLimit")
val forceCaseInsensitive = config.getBoolean("computer.debug.forceCaseInsensitiveFS")
val logFullLibLoadErrors = config.getBoolean("computer.debug.logFullNativeLibLoadErrors")
val forceNativeLib = config.getString("computer.debug.forceNativeLibWithName")
// ----------------------------------------------------------------------- //
// robot

View File

@ -3,6 +3,7 @@ package li.cil.oc.util
import java.io.{File, FileInputStream, FileOutputStream}
import java.nio.channels.Channels
import com.google.common.base.Strings
import com.naef.jnlua
import com.naef.jnlua.LuaState
import com.naef.jnlua.NativeSupport.Loader
@ -92,7 +93,7 @@ object LuaStateFactory {
}
// Try to find a working lib.
for (library <- libNames if !haveNativeLibrary) {
for (library <- libNames if !haveNativeLibrary && (Strings.isNullOrEmpty(Settings.get.forceNativeLib) || library == Settings.get.forceNativeLib)) {
OpenComputers.log.trace(s"Trying native library '$library'...")
val libraryUrl = classOf[Machine].getResource(libPath + library)
if (libraryUrl != null) {
@ -178,8 +179,13 @@ object LuaStateFactory {
haveNativeLibrary = true
}
catch {
case _: Throwable =>
OpenComputers.log.trace(s"Could not load native library '${file.getName}'.")
case t: Throwable =>
if (Settings.get.logFullLibLoadErrors) {
OpenComputers.log.info(s"Could not load native library '${file.getName}'.", t)
}
else {
OpenComputers.log.trace(s"Could not load native library '${file.getName}'.")
}
file.delete()
}
}