Projucer / Xcode resource question


#1

I have a text file (todo-list) in my jucer-project, for convenience, and I noticed that somehow it ends up in the plugin bundle (Contents/Resources folder). In Projucer I have the “Xcode Resource” flag disabled for this file, and it ends up in the build anyway, how can I disable this and still keep the file in my project? :slight_smile:


#2

If you click on the parent folder of that file in the Projucer’s file tree, it has options for each file that let you say whether it gets put into the binary data.


#3

@jules Yes that’s how I’ve done it in the past, but it doesn’t seem to respect my options for text files? I haven’t seen this behaviour until some of the recent updates. Am I doing it wrong? :wink: It worked the expected way until i added a ‘.txt’ extension to my file.


#4

Hmm… Tried it myself and it seems to work ok.


#5

I rebuilt Projucer, making sure I use the latest commits, I tried adding a .rtf file to the project as well, tried it with Xcode resource checked and unchecked, I get the same behaviour as mentioned earlier and the file ends up in the build… If I remove the .txt extension it works as expected: the file is browsable in the project-tree and is not located in the Resources folder. Can anyone else confirm this since Jules can’t replicate it?

It’s not a big deal until you accidentally ship your product with potentially sensitive data in your resource folder because you didn’t realise was there :wink:


#6

Yeah, that does sound wrong, but I can’t reproduce it - I tried with a txt file and it worked as expected…


#7

I couldn’t leave this alone just yet,
jucer_ProjectExport_Xcode.h at line 2193 in the addFile (…) method:

    else if (! shouldBeAddedToBinaryResources || shouldBeAddedToXcodeResources)
    {
        const String fileType (getFileType (path));

        if (shouldBeAddedToXcodeResources || fileType.startsWith ("image.") || fileType.startsWith ("text.") || fileType.startsWith ("file."))
        {
            resourceIDs.add (addBuildFile (pathAsString, refID, false, false));
            resourceFileRefs.add (refID);
        }
    }

May I suggest you change this to

if (shouldBeAddedToXcodeResources && (fileType.startsWith (“image.”) || fileType.startsWith (“text.”) || fileType.startsWith (“file.”)))

and then I shouldn’t be able to replicate it anymore either :slight_smile:


#8

Hmm, that line does seem wrong. I wonder how it wasn’t doing that in my case… I’ll double-check the logic there and try to fix these edge-cases…