Skip to content

Commit

Permalink
Fix: create directories on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
amankgo committed Jan 12, 2022
1 parent 8ea02eb commit cc2f599
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 1 addition & 3 deletions src/main/kotlin/app/MainWindow.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package app

import androidx.compose.runtime.Composable
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.ApplicationScope
import androidx.compose.ui.window.Window
import androidx.compose.ui.window.WindowPlacement
Expand Down Expand Up @@ -30,7 +28,7 @@ fun ApplicationScope.appWindow() {
}
Thread.setDefaultUncaughtExceptionHandler(CustomExceptionHandler())
SentryHelper.init()
val windowState = rememberWindowState(WindowPlacement.Floating, size = DpSize(1440.dp, 1024.dp))
val windowState = rememberWindowState(WindowPlacement.Maximized)
Window(onCloseRequest = onCloseRequest, title = CustomTheme.strings.appName, state = windowState) {
App()
}
Expand Down
12 changes: 7 additions & 5 deletions src/main/kotlin/inputs/adb/ddmlib/AdbHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ object AdbHelper {
private const val PACKAGES_COMMAND = "pm list packages -3 -e"
// list of lines with format : package:com.ea.games.r3_row

private const val ADB_TIMEOUT = 10L

fun init() {
val options = AdbInitOptions.builder().setClientSupportEnabled(true).build()
AndroidDebugBridge.init(options)
AndroidDebugBridge.addDeviceChangeListener(Devices())
val adbPath = adbPath()
bridge = if (!adbPath.isNullOrBlank()) {
AndroidDebugBridge.createBridge(adbPath, false, 10, TimeUnit.SECONDS)
AndroidDebugBridge.createBridge(adbPath, false, ADB_TIMEOUT, TimeUnit.SECONDS)
} else {
AndroidDebugBridge.createBridge(10, TimeUnit.SECONDS)
AndroidDebugBridge.createBridge(ADB_TIMEOUT, TimeUnit.SECONDS)
}
AndroidDebugBridge.addDebugBridgeChangeListener {
bridge = it
Expand Down Expand Up @@ -112,18 +114,18 @@ object AdbHelper {
suspend fun getPackages(device: IDevice, onValue: (packages: List<String>) -> Unit) = withContext(Dispatchers.IO) {
device.executeShellCommand(
PACKAGES_COMMAND, PackagesReceiver(onValue),
10, TimeUnit.SECONDS
ADB_TIMEOUT, TimeUnit.SECONDS
)
}

private fun IDevice.emptyShellCommand(command: String) {
executeShellCommand(
command,
EmptyReceiver, 10, TimeUnit.SECONDS
EmptyReceiver, ADB_TIMEOUT, TimeUnit.SECONDS
)
}

private fun adbPath(): String? {
fun adbPath(): String? {
val androidEnvHome: File? = try {
System.getenv("ANDROID_HOME") ?: System.getenv("ANDROID_SDK_ROOT")
} catch (e: SecurityException) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/storage/StorageHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ object StorageHelper {
val posixAttribute = PosixFilePermissions.asFileAttribute(
PosixFilePermissions.fromString("rwxr-x---")
)
Files.createDirectory(folder.toPath(), posixAttribute)
Files.createDirectories(folder.toPath(), posixAttribute)
} else {
Files.createDirectory(folder.toPath())
Files.createDirectories(folder.toPath())
}
} catch (e: IOException) {
throw IOException("Cannot create app folder at path ${folder.canonicalPath}", e)
Expand Down

0 comments on commit cc2f599

Please sign in to comment.