diff --git a/TODO.md b/TODO.md index 76c4425a..59a99e04 100644 --- a/TODO.md +++ b/TODO.md @@ -110,7 +110,7 @@ - `app/src/main/kotlin/bums/lunatic/launcher/player/PlayerActivity.kt:78-80` — `rebootEngine` 콜백에서 `Surface(videoTextureView.surfaceTexture!!)` 사용 시, 비동기 준비 완료 시점에 `TextureView`가 이미 해제(`surfaceTexture == null`)되었으면 `NullPointerException` 발생. - **작업**: `videoTextureView.surfaceTexture?.let { nativePlayer?.play(Surface(it)) }`로 null-safe 처리 및 `isDestroyed`/`isFinishing` 체크 추가. -- [ ] **3-5. `LunaticLauncher` 초기화 시 외부 저장소/GeckoRuntime 예외 처리** +- [x] **3-5. `LunaticLauncher` 초기화 시 외부 저장소/GeckoRuntime 예외 처리** - `app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt:119-126` — 하드코딩된 경로(`/storage/emulated/0/bums_ob/...`) 접근 시 권한이 없거나 경로 생성 실패 시 예외 처리 부재. - `app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt:130` — 주석은 `// 60MB`이나 실제 계산식은 `1024L * 1024 * 1024 * 6` (6GB)로 되어 있어 디스크 공간/캐시 정책 확인 필요. - **작업**: `getExternalFilesDir` 기반 안전 경로 폴백 추가 및 캐시 크기 상수 점검. diff --git a/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt b/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt index ebf155fe..674178a3 100644 --- a/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt +++ b/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt @@ -117,18 +117,21 @@ prefs: privateCompletedDir = File(getExternalFilesDir(null), "completed_torrents") PrefHelper.initialize(this) Base64ImageCache.init(this) - val dir = File("/storage/emulated/0/bums_ob/BUM'S PACED /scraped/logs") - ///BUM'S PACED/pdfs - if (!dir.exists()) { - dir.mkdirs() - } else { -// dir.listFiles().forEach { Blog.LOGE("child -> ${it.absolutePath}") } + val dir = try { + val externalDir = File("/storage/emulated/0/bums_ob/BUM'S PACED /scraped/logs") + if (externalDir.exists() || externalDir.mkdirs()) { + externalDir + } else { + File(getExternalFilesDir(null), "logs").apply { mkdirs() } + } + } catch (_: Exception) { + File(getExternalFilesDir(null), "logs").apply { mkdirs() } } mHourlyLogWriter = HourlyLogWriter(dir) val logging = HttpLoggingInterceptor().apply { level = HttpLoggingInterceptor.Level.NONE } - val cacheSize = 1024L * 1024 * 1024 * 6 // 60MB + val cacheSize = 60L * 1024 * 1024 // 60MB val cache = Cache(File(this.filesDir, "picasso-cache"), cacheSize) val okHttpClient = OkHttpClient.Builder() .cache(cache)