bkaradzic / GENie

GENie - Project generator tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include Assets (Resources) in Xcode?

MK-Alias opened this issue · comments

Hi There!,

Is there perhaps a way to include Assets in Xcode? I've tried setting up xcodecopyresources but this does not do anything. I've listed it in the project section just as the documentation specifies. (also tried it in configarutions but also no luck).

Is it broke..? What I basicly need is to put some files in the "Copy Bundle Resources" list of the Build phases section.

ss

But so far, without any luck!

Is there any way that this can be done?

Thnx!

Hi,

try setting your xcodecopyresources like this:

xcodecopyresources {
	{'targetFolderA', {
		path.join(asset_root, "subfolder"),
	}},
	{'targetFolderB', {
		os.matchfiles(path.join(arcana_root, "subdir", "**.sparsefile")),
	}},
}

with, respectively

  • targetFolderA a folder under whatever.app/Resources
  • targetFolderB another folder under whatever.app/Resources
  • asset_root a variable defined elsewhere that holds the path to the root of your assets dir
  • subfolder a string of a folder name that is to copy as-is
  • subdir a string of a folder name that contains sparsefiles to copy
  • **.sparsefile a wildcard of os.matchfiles to match whatver .sparsefile it finds in the given folder and below.

Below is an actual example copy-pasted from my current project:

		xcodecopyresources {
			{'Assets', { -- goes to '.app/Resources/Assets
				path.join(arcana_root, "engine-assets"),
				path.join(kenyagame_root, "assets"),
			}},
			{'Config', {  -- goes to '.app/Resources/Config
				os.matchfiles(path.join(arcana_root, "engine-config", "**.ios.config")),
				os.matchfiles(path.join(kenyagame_root, "config", "**.ios.config")),
			}},
		}

btw, a stupid copy (or rsync (faster!) works as well,
e.g.

postbuildcommands {
			"mkdir -p ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Assets",
			"mkdir -p ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Config",
			"rsync -amyzhv " .. path.join(arcana_root, "engine-assets") .. " ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Assets/",
			"rsync -amyzhv " .. path.join(kenyagame_root, "assets") .. " ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Assets/",
			"rsync -amyzhv " .. path.join(arcana_root, "engine-config", "**.ios.config") .. " ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Config/",
			"rsync -amyzhv " .. path.join(kenyagame_root, "config", "**.ios.config") .. " ${TARGET_BUILD_DIR}/${PRODUCT_NAME}.app/Config/",
		}

Hello, thanks for your response!

I'm away from my development machine for the moment but will try your method in a couple of days or so., and I will get back to you afterwards.!

Thanks!

Hello again,

Well, no matter what I try., i'm unable to copy the assets with the GENie script. I did exactly what you've suggested but still no luck.

The tip of just copying it to the App Folder did work like a charm do! So thanks for mentioning that. I'm using GENie in my personal 2D game/app engine... Mostly because the xcode projects are a monster to generate. So kudos for getting that to work. (I'm generating Gradle, VS2019/Win32, VS2019/UWP without problems... But xcode... pffff).

For now I'll just be using the copy method for the assets.

Thanks for your help.!