Clear the list used for parsing recipes

master
Wynd 2026-03-13 22:09:20 +02:00
parent 68a4cecaa4
commit d9773c9fc2
3 changed files with 4 additions and 6 deletions

View File

@ -23,7 +23,7 @@ fun import(ctx: MainActivity, nav: NavHostController, setLoading: (Boolean) -> U
while(!ctx.importFinished) {} while(!ctx.importFinished) {}
} catch (e: Exception) { } catch (e: Exception) {
ctx.importError = when (e) { ctx.importError = when (e) {
else -> "Exception occurred: ${e.javaClass.canonicalName}" else -> "Exception occurred: ${e.message}"
} }
e.printStackTrace() e.printStackTrace()
} }

View File

@ -78,6 +78,7 @@ fun parseRecipeFiles(ctx: MainActivity) {
} }
Recipe.clearCache() Recipe.clearCache()
recipeFiles.clear()
// ctx.filesDir.walkTopDown().forEach { println(it.absolutePath + " | " + Path(it.absolutePath).fileSize()) } // ctx.filesDir.walkTopDown().forEach { println(it.absolutePath + " | " + Path(it.absolutePath).fileSize()) }
} }

View File

@ -66,10 +66,7 @@ fun sync(ctx: MainActivity, nav: NavHostController, setLoading: (Boolean) -> Uni
parentDir.mkdirs() parentDir.mkdirs()
val newFile = File(parentDir, fileName) val newFile = File(parentDir, fileName)
if (!newFile.exists()) { if (newFile.isDirectory) {
newFile.createNewFile()
}
else if (newFile.isDirectory) {
continue continue
} }
@ -107,7 +104,7 @@ fun sync(ctx: MainActivity, nav: NavHostController, setLoading: (Boolean) -> Uni
} catch (e: Exception) { } catch (e: Exception) {
ctx.importError = when (e) { ctx.importError = when (e) {
is SocketTimeoutException -> "Connection timed out" is SocketTimeoutException -> "Connection timed out"
else -> "Exception occurred: ${e.javaClass.canonicalName}" else -> "Exception occurred: ${e.message}"
} }
e.printStackTrace() e.printStackTrace()
} }