mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-09 11:04:36 +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
|
directory, *mipmapIconResourceFileNames
|
||||||
)
|
)
|
||||||
}.let { resourceGroups ->
|
}.let { resourceGroups ->
|
||||||
val path = File(appIcon)
|
try {
|
||||||
val resourceDirectory = context["res"]
|
val path = File(appIcon)
|
||||||
|
val resourceDirectory = context["res"]
|
||||||
|
|
||||||
resourceGroups.forEach { group ->
|
resourceGroups.forEach { group ->
|
||||||
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
||||||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
||||||
|
|
||||||
group.resources.forEach { iconFileName ->
|
group.resources.forEach { iconFileName ->
|
||||||
Files.write(
|
Files.write(
|
||||||
toDirectory.resolve(iconFileName).toPath(),
|
toDirectory.resolve(iconFileName).toPath(),
|
||||||
fromDirectory.resolve(iconFileName).readBytes()
|
fromDirectory.resolve(iconFileName).readBytes()
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
throw PatchException("Invalid app icon path: $appIcon")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -113,21 +113,25 @@ object CustomBrandingIconPatch : ResourcePatch() {
|
|||||||
directory, *mipmapIconResourceFileNames
|
directory, *mipmapIconResourceFileNames
|
||||||
)
|
)
|
||||||
}.let { resourceGroups ->
|
}.let { resourceGroups ->
|
||||||
val path = File(appIcon)
|
try {
|
||||||
val resourceDirectory = context["res"]
|
val path = File(appIcon)
|
||||||
|
val resourceDirectory = context["res"]
|
||||||
|
|
||||||
resourceGroups.forEach { group ->
|
resourceGroups.forEach { group ->
|
||||||
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
val fromDirectory = path.resolve(group.resourceDirectoryName)
|
||||||
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
val toDirectory = resourceDirectory.resolve(group.resourceDirectoryName)
|
||||||
|
|
||||||
group.resources.forEach { iconFileName ->
|
group.resources.forEach { iconFileName ->
|
||||||
Files.write(
|
Files.write(
|
||||||
toDirectory.resolve(iconFileName).toPath(),
|
toDirectory.resolve(iconFileName).toPath(),
|
||||||
fromDirectory.resolve(iconFileName).readBytes()
|
fromDirectory.resolve(iconFileName).readBytes()
|
||||||
)
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
context.updatePatchStatusIcon("custom")
|
||||||
|
} catch (_: Exception) {
|
||||||
|
throw PatchException("Invalid app icon path: $appIcon")
|
||||||
}
|
}
|
||||||
context.updatePatchStatusIcon("custom")
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val resourcePath = "youtube/branding/$appIconValue"
|
val resourcePath = "youtube/branding/$appIconValue"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user