From 9706b1e68ff3bc3abc464930462b0a2caf4c81cb Mon Sep 17 00:00:00 2001 From: lunaticbum Date: Mon, 16 Nov 2026 12:46:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20Task=2014=20=EC=99=84=EB=A3=8C=20-=20Lun?= =?UTF-8?q?aticLauncher=20=EC=99=B8=EB=B6=80=20=EC=A0=80=EC=9E=A5=EC=86=8C?= =?UTF-8?q?=20=ED=8F=B4=EB=B0=B1=20=EB=B0=8F=20Picasso=20=EC=BA=90?= =?UTF-8?q?=EC=8B=9C=20=ED=81=AC=EA=B8=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - LunaticLauncher.kt onCreate(): * 하드코딩된 /storage/emulated/0/... 로그 경로 접근 실패 또는 권한 부족 시 getExternalFilesDir(null)/logs로 안전 폴백하도록 try-catch 보강 * Picasso OkHttp 캐시 크기 계산 오류(1024L * 1024 * 1024 * 6 = 6GB)를 주석 의도대로 60L * 1024 * 1024(60MB)로 수정 - TODO.md: 3-5 항목 완료 처리 - 검증: ./gradlew :app:compileDebugKotlin 빌드 성공 확인 (2s) --- TODO.md | 2 +- .../bums/lunatic/launcher/LunaticLauncher.kt | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) 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)