Skip to content

Commit

Permalink
Changing the path for saving the image (#1379)
Browse files Browse the repository at this point in the history
Change the path for saving comment images in the plugin to match the
path used by the app.
  • Loading branch information
oxy2ray committed Feb 4, 2024
1 parent 61e166c commit 34bd5fd
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class CommentImageHook(classLoader: ClassLoader) : BaseHook(classLoader) {
companion object {
fun saveImage(url: String) = runCatching {
URL(url).openStream().use { stream ->
val relativePath = "${Environment.DIRECTORY_PICTURES}${File.separator}bilibili"
val relativePath = "${Environment.DIRECTORY_PICTURES}${File.separator}bili"
val fullFilename = url.substringAfterLast('/')
val filename = fullFilename.substringBeforeLast('.')

Expand All @@ -41,7 +41,7 @@ class CommentImageHook(classLoader: ClassLoader) : BaseHook(classLoader) {
val path = File(
Environment.getExternalStoragePublicDirectory(
Environment.DIRECTORY_PICTURES
), "bilibili"
), "bili"
).also { it.mkdirs() }
put(MediaStore.MediaColumns.DATA, File(path, fullFilename).absolutePath)
}
Expand Down

0 comments on commit 34bd5fd

Please sign in to comment.