Skip to content

Commit

Permalink
fix: possible fix for crash when mpv.conf doesn't exist on applicatio…
Browse files Browse the repository at this point in the history
…n path

related to #48 (comment)
  • Loading branch information
abdallahmehiz committed Sep 8, 2024
1 parent c1e544b commit 8a49c86
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,12 @@ class PlayerActivity : AppCompatActivity() {
if (!fileManager.exists(mpvConf)) error("Couldn't access mpv configuration directory")
fileManager.copyDirectoryWithContent(mpvConf, fileManager.fromPath(applicationPath), true)
} catch (e: Exception) {
File("$applicationPath/mpv.conf").writeText(advancedPreferences.mpvConf.get())
File("$applicationPath/input.conf").writeText(advancedPreferences.inputConf.get())
File("$applicationPath/mpv.conf")
.also { if (!it.exists()) it.createNewFile() }
.writeText(advancedPreferences.mpvConf.get())
File("$applicationPath/input.conf")
.also { if (!it.exists()) it.createNewFile() }
.writeText(advancedPreferences.inputConf.get())
Log.e("PlayerActivity", "Couldn't copy mpv configuration files: ${e.message}")
}
}
Expand Down

0 comments on commit 8a49c86

Please sign in to comment.