mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-09 02:54:37 +02:00
fix(Custom branding icon): displays an appropriate error if the path to patch options is invalid
This commit is contained in:
parent
9b15d234e3
commit
b81392a2d4
@ -68,19 +68,23 @@ object CustomBrandingIconPatch : ResourcePatch() {
|
||||
directory, *mipmapIconResourceFileNames
|
||||
)
|
||||
}.let { resourceGroups ->
|
||||
val path = File(appIcon)
|
||||
val resourceDirectory = context["res"]
|
||||
try {
|
||||
val path = File(appIcon)
|
||||
val resourceDirectory = context["res"]
|
||||
|
||||
resourceGroups.forEach { group ->
|
||||
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
||||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
||||
resourceGroups.forEach { group ->
|
||||
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
||||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
||||
|
||||
group.resources.forEach { iconFileName ->
|
||||
Files.write(
|
||||
toDirectory.resolve(iconFileName).toPath(),
|
||||
fromDirectory.resolve(iconFileName).readBytes()
|
||||
)
|
||||
group.resources.forEach { iconFileName ->
|
||||
Files.write(
|
||||
toDirectory.resolve(iconFileName).toPath(),
|
||||
fromDirectory.resolve(iconFileName).readBytes()
|
||||
)
|
||||
}
|
||||
}
|
||||
} catch (_: Exception) {
|
||||
throw PatchException("Invalid app icon path: $appIcon")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -113,21 +113,25 @@ object CustomBrandingIconPatch : ResourcePatch() {
|
||||
directory, *mipmapIconResourceFileNames
|
||||
)
|
||||
}.let { resourceGroups ->
|
||||
val path = File(appIcon)
|
||||
val resourceDirectory = context["res"]
|
||||
try {
|
||||
val path = File(appIcon)
|
||||
val resourceDirectory = context["res"]
|
||||
|
||||
resourceGroups.forEach { group ->
|
||||
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
||||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
||||
resourceGroups.forEach { group ->
|
||||
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
||||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
||||
|
||||
group.resources.forEach { iconFileName ->
|
||||
Files.write(
|
||||
toDirectory.resolve(iconFileName).toPath(),
|
||||
fromDirectory.resolve(iconFileName).readBytes()
|
||||
)
|
||||
group.resources.forEach { iconFileName ->
|
||||
Files.write(
|
||||
toDirectory.resolve(iconFileName).toPath(),
|
||||
fromDirectory.resolve(iconFileName).readBytes()
|
||||
)
|
||||
}
|
||||
}
|
||||
context.updatePatchStatusIcon("custom")
|
||||
} catch (_: Exception) {
|
||||
throw PatchException("Invalid app icon path: $appIcon")
|
||||
}
|
||||
context.updatePatchStatusIcon("custom")
|
||||
}
|
||||
} else {
|
||||
val resourcePath = "youtube/branding/$appIconValue"
|
||||
|
Loading…
x
Reference in New Issue
Block a user