twres: fix folder copy on dirty builds
Add MkdirAll before trying to copy to twres folder
Change-Id: I66f150828f804fd36bbcfd2bc9ee17c54761d672
diff --git a/gui/libguitwrp_defaults.go b/gui/libguitwrp_defaults.go
index 9e8fd0b..4c64f50 100644
--- a/gui/libguitwrp_defaults.go
+++ b/gui/libguitwrp_defaults.go
@@ -42,6 +42,7 @@
func copyThemeResources(ctx android.BaseContext, dirs []string, files []string) {
outDir := ctx.Config().Getenv("OUT")
twRes := outDir + "/recovery/root/twres/"
+ os.MkdirAll(twRes, os.ModePerm)
recoveryDir := getRecoveryAbsDir(ctx)
theme := determineTheme(ctx)
for idx, dir := range dirs {
@@ -68,6 +69,7 @@
func copyCustomTheme(ctx android.BaseContext, customTheme string) {
outDir := ctx.Config().Getenv("OUT")
twRes := outDir + "/recovery/root/twres/"
+ os.MkdirAll(twRes, os.ModePerm)
fileDest := twRes + path.Base(customTheme)
fileToCopy := fmt.Sprintf("%s%s", getBuildAbsDir(ctx), customTheme)
copyFile(fileToCopy, fileDest)