File tree Expand file tree Collapse file tree 4 files changed +12
-6
lines changed
fxgl-core/src/main/kotlin/com/almasb/fxgl/core/util
main/kotlin/com/almasb/fxgl/io
test/kotlin/com/almasb/fxgl/io
fxgl/src/main/kotlin/com/almasb/fxgl/app Expand file tree Collapse file tree 4 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,9 @@ enum class Platform {
21
21
val isDesktop: Boolean
22
22
get() = this == = WINDOWS || this == = MAC || this == = LINUX
23
23
24
+ val isEmbedded: Boolean
25
+ get() = this == = EMBEDDED
26
+
24
27
companion object {
25
28
@JvmStatic fun get (): Platform {
26
29
// check if running on mobile first
Original file line number Diff line number Diff line change @@ -26,16 +26,16 @@ class FileSystemService : EngineService() {
26
26
27
27
private val log = Logger .get(javaClass)
28
28
29
- @Inject(" isDesktop " )
30
- private var isDesktop = true
29
+ @Inject(" isMobile " )
30
+ private var isMobile = false
31
31
32
32
@Inject(" isFileSystemWriteAllowed" )
33
33
private var isFileSystemWriteAllowed = true
34
34
35
35
private lateinit var fs: FileSystemAccess
36
36
37
37
override fun onInit () {
38
- val rootStorage = if (isDesktop )
38
+ val rootStorage = if (! isMobile )
39
39
File (System .getProperty(" user.dir" ) + " /" )
40
40
else
41
41
StorageService .create()
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ class FileSystemServiceTest {
49
49
50
50
fs = FileSystemService ()
51
51
val injectMap = mapOf (
52
- " isDesktop " to true ,
52
+ " isMobile " to false ,
53
53
" isFileSystemWriteAllowed" to true )
54
54
55
55
InjectInTest .inject(MethodHandles .lookup(), fs, injectMap)
@@ -237,7 +237,7 @@ class FileSystemServiceTest {
237
237
fun `Fail on mobile if no private storage present` () {
238
238
val f = FileSystemService ()
239
239
val injectMap = mapOf (
240
- " isDesktop " to false ,
240
+ " isMobile " to true ,
241
241
" isFileSystemWriteAllowed" to true )
242
242
243
243
InjectInTest .inject(MethodHandles .lookup(), f, injectMap)
@@ -251,7 +251,7 @@ class FileSystemServiceTest {
251
251
fun `FS is not changed if FS write is not allowed` () {
252
252
val f = FileSystemService ()
253
253
val injectMap = mapOf (
254
- " isDesktop " to true ,
254
+ " isMobile " to false ,
255
255
" isFileSystemWriteAllowed" to false )
256
256
257
257
InjectInTest .inject(MethodHandles .lookup(), f, injectMap)
Original file line number Diff line number Diff line change @@ -653,6 +653,9 @@ class ReadOnlyGameSettings internal constructor(
653
653
val isMobile: Boolean
654
654
get() = platform.isMobile
655
655
656
+ val isEmbedded: Boolean
657
+ get() = platform.isEmbedded
658
+
656
659
val isBrowser: Boolean
657
660
get() = platform.isBrowser
658
661
You can’t perform that action at this time.
0 commit comments