Resource not being bundled into app - macos

I have shaders named basic_shader.vsh and basic_shader.fsh. I added both of these two files to the Copy Bundle Resources build phase. But they are not being copied into the bundle app. And they don't appear in the Log Navigator. Xcode builder effectively ignores them.
They are located into a directory outside the source directory. I don't know if that is relevant. The funny thing is that a png image also located outside the source directory is being copied inside the bundle. My app is a Mac OS X app using Cocoa.

I solved by adding into the Copy Files build phase (setting the destination to Resources) instead of the Copy Bundle Resources build phase... I don't know why it solves the problem as I don't really understand the problem, actually...
Thanks anyway...

For some reason .metal files are not regarded as resources. If you just change the extension to anything else they're copied in the bundle.

Make sure your shaders are copied into your resources

Related

macOS Application Bundle Frameworks Directory Codesign

I am packing my macOS application into an application bundle. I need to codesign it and pass notarisation. It is possible to put the frameworks in the "Resources" directory?
I have two frameworks. Normally, I used to put such frameworks into the "Frameworks" directory of the bundle. However, for (stupid) designing reason I need to have some more libraries in the same directory of my frameworks. Since such libraries will prevent code signing if placed in the directory "Frameworks", I want to move frameworks + extra libraries into the "Resources" directory.
Reading Apple documentation it seems that frameworks should - of course - belong to the "Frameworks" directory, however I could not find any reference to what should NOT be included into the "Resources" directory. Is this bad practice? Would my .app structure not pass gatekeeper?
Any suggestion would be very much appreciated
You've probably already tried putting a frameworks in Resources by now. As you said, even if it works today, this is not a good idea.
You might be able to work around whatever issue caused you to want to do this by using the install_name_tool to change one of the paths built into your frameworks. Adding symbolic links are another handy device for issues like this. This kind of stuff can be done automatically in a Run Script Build Phase or a Build Phase Post Action.

Unzip .app file without it turning into folders

A company I work with have an issue where a zipped .app file is resolving into its bundled folders once unzipped.
What is the best way to compress an .app so that it can be decompressed without that it resolves into folders, that is the want it to remain a single .app file?
Use another format than zip? Compress it in binary?
Thanks in advance
You shouldn't be having any problems with this. As I'L'I points out, an application on the Mac is a bundle of folders. It's just that the Finder presents it to the user as a single entity.
Zipping and unzipping the bundle won't change this. The Finder recognises the .app extension and acts accordingly. It is not necessary to set what used to be called the 'bundle' bit on the top-level folder. That would get lost by round-tripping the app through a .zip file, but that's not important anymore.
So the real question is, how are you inspecting the unzipped copy of your app? If it's via the command line, or some other tool that doesn't know (or care) that apps are really bundles then you will indeed get the behaviour you describe, even with the original.
I couldn't find any way to break the Finder's 'single entity' view of an app, even if I deliberately damaged it but maybe you have found a way. If so, I'd be interested to know how you did it.

Creating a Cocoa Framework

I've created a working Cocoa framework which I wish to redistribute. The problem is however, it won't run outside of Xcode. I've read something about #executable_path/../Frameworks, which I did not include, because I don't know where to put it :/
Therefore I run my app in Xcode using the DYLD_FRAMEWORK_PATH variable which works fine, but only in Xcode - if I try to run it on its own it crashes straight away and says IMAGE NOT FOUND.
I'm sure #executable_path/../Frameworks is what's missing, but I don't know where to put it.
Could anyone help me out please? :)
Thanks
Here is how I usually manage things:
In the framework's Xcode project, set the Installation Directory to #rpath
Add the framework to your application's Xcode project. Add a Copy Files build phase, select Frameworks in the Destination popup, and ensure your framework is added so it will be copied to your application's Frameworks directory when it is built.
Finally, in your project's settings, add #loader_path/../Frameworks to Runpath Search Paths.
Are you actually copying the framework into your applications bundle? Look for the folder called MacOS which is what contains the binary. There should be another folder at the same level called Frameworks and it should have the framework inside it.
If it's not there you need to create a copy files build phase for the application that copies the framework into the Frameworks folder.

deploying resource files from xcode

How does one copy resource files (config/data/image) files to an applictions home directory on the iPhone.
A related question Loading Data Files on iPhone?, received an answer "just add them to your project; Xcode will copy them to the .app bundle when it builds your application".
How does one do this? (If this is a simple question, a manual reference/page# is fine)
I want to be able to copy a file onto the iPhone simulator and open it at runtime. I have tried to do this by adding 'copy file' targets, although I havent been able to find the files at runtime.
I know using property list, or sql lite database is prefered over file io, but I would still like to understand how to achieve this.
In my app, I have a sql lite DB which I just dropped in the root of my project folder and added to the resources folder of my project, and it winds up in the bundle, accessible by the app.
http://img68.imageshack.us/img68/3047/xcoderesourceslw5.png
I assume this will work for any file. I didn't have to write any special targets or operations.
In your app, this file then shows up as follows:
NSString *dbFilePath = [[NSBundle mainBundle]
pathForResource:#"dictionary"
ofType:#"db"];
I just found this site, Bundle Programming Guide it explains, how to access resources set in your project at runtime. I assume its just as easy to use single files.

Which Qt DLL's should I copy to make my program stand-alone?

I'm trying to make a distribution directory with my application. I've copied several Qt DLLs to that directory, and the program seems to be working, with one exception: it doesn't seem to find SQL plugin for SQLite. Copying qtsqlite.dll to the directory, doesn't allow my application to open or create SQLite files. What must be the direcotry structure or which additional files need to be copied so that the program can read the database?
you can use depends.exe to see exactly what the dependencies of your exe are and make sure they're all included.
Also, read this page about qt plugins. they are supposed to be in a specific directory called "plugins" and not in the main directory with all the other dlls.
Most probably, the qtsqlite.dll itself depends on original SQLite DLL's which you probably need to copy as well.
Don't forget to include an LGP license copy in your distribution as well as pointers to the original download ressources of the libs you include and their sources. To stay with the law :-)
Thanks to the link #shoosh provided, I was able to fix the problem. I needed to create sqldrivers subdirectory in the distribution dir with qsqlite.dll library inside. But that was just step one. Do you have any tips and resources on creating a full-blown Windows installer? I'm mainly a Linux programmer so this area is unknown to me.

Resources