Improve: Verbose logcat

This commit is contained in:
zt515
2017-08-15 12:53:02 +08:00
parent 6cf14f60bc
commit 58e63ecf13
5 changed files with 22 additions and 6 deletions

View File

@ -6,6 +6,7 @@ import io.neoterm.R
import io.neoterm.frontend.preference.NeoPreference
import io.neoterm.frontend.preference.NeoTermPath
import io.neoterm.frontend.component.NeoComponent
import io.neoterm.frontend.logging.NLog
import io.neoterm.utils.AssetsUtils
import io.neoterm.frontend.terminal.TerminalView
import io.neoterm.frontend.terminal.eks.ExtraKeysView
@ -90,6 +91,7 @@ class ColorSchemeComponent : NeoComponent {
AssetsUtils.extractAssetsDir(context, "colors", NeoTermPath.COLORS_PATH)
return true
} catch (e: Exception) {
NLog.e("ColorScheme", "Failed to extract default colors: ${e.localizedMessage}")
return false
}
}

View File

@ -4,6 +4,7 @@ import io.neolang.runtime.type.NeoLangValue
import io.neolang.visitor.ConfigVisitor
import io.neoterm.component.eks.NeoExtraKey
import io.neoterm.frontend.config.NeoConfigureFile
import io.neoterm.frontend.logging.NLog
import io.neoterm.frontend.terminal.eks.button.TextButton
import java.io.BufferedReader
import java.io.File
@ -20,6 +21,7 @@ class OldExtraKeysConfigureFile(configureFile: File) : NeoConfigureFile(configur
val config = parseOldConfig(BufferedReader(FileReader(configureFile)))
return generateVisitor(config)
} catch (e: Exception) {
NLog.e("ConfigureLoader", "Failed to load old extra keys config: ${e.localizedMessage}")
return false
}
}

View File

@ -1,6 +1,7 @@
package io.neoterm.component.pm
import io.neoterm.R
import io.neoterm.frontend.logging.NLog
import io.neoterm.frontend.preference.NeoPreference
import io.neoterm.frontend.preference.NeoTermPath
import java.io.File
@ -13,13 +14,19 @@ object SourceUtils {
fun detectSourceFiles(): ArrayList<File> {
val sourceFiles = ArrayList<File>()
val sourceUrl = NeoPreference.loadString(R.string.key_package_source, NeoTermPath.DEFAULT_SOURCE)
val packageFilePrefix = detectSourceFilePrefix(sourceUrl)
if (packageFilePrefix.isNotEmpty()) {
File(NeoTermPath.PACKAGE_LIST_DIR)
.listFiles()
.filterTo(sourceFiles) { it.name.startsWith(packageFilePrefix) }
try {
val sourceUrl = NeoPreference.loadString(R.string.key_package_source, NeoTermPath.DEFAULT_SOURCE)
val packageFilePrefix = detectSourceFilePrefix(sourceUrl)
if (packageFilePrefix.isNotEmpty()) {
File(NeoTermPath.PACKAGE_LIST_DIR)
.listFiles()
.filterTo(sourceFiles) { it.name.startsWith(packageFilePrefix) }
}
} catch (e: Exception) {
sourceFiles.clear()
NLog.e("PM", "Failed to detect source files: ${e.localizedMessage}")
}
return sourceFiles
}
@ -40,6 +47,7 @@ object SourceUtils {
builder.append("_dists_stable_main_binary-")
return builder.toString()
} catch (e: Exception) {
NLog.e("PM", "Failed to detect source file prefix: ${e.localizedMessage}")
return ""
}
}

View File

@ -9,6 +9,7 @@ import android.util.TypedValue
import io.neoterm.App
import io.neoterm.R
import io.neoterm.backend.TerminalSession
import io.neoterm.frontend.logging.NLog
import io.neoterm.services.NeoTermService
import io.neoterm.utils.FileUtils
import java.io.File
@ -161,6 +162,7 @@ object NeoPreference {
Os.symlink(loginProgramPath, NeoTermPath.NEOTERM_SHELL_PATH)
Os.chmod(NeoTermPath.NEOTERM_SHELL_PATH, 448 /*Decimal of 0700 */)
} catch (e: ErrnoException) {
NLog.e("Preference", "Failed to symlink login shell: ${e.localizedMessage}")
e.printStackTrace()
}
}

View File

@ -1,5 +1,6 @@
package io.neoterm.utils
import io.neoterm.frontend.logging.NLog
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
@ -18,6 +19,7 @@ object FileUtils {
true
}
} catch (e: Exception) {
NLog.e("FileUtils", "Failed to write file: ${e.localizedMessage}")
return false
}
}