Where to put assets in xcode? [duplicate] - c++

This question have been asked numerous times, but I have not managed to get an answer that I am happy with. Probably because the most answers is of "how do I do this?" type and also get "this way you do this" answers.
The problem I have is that I need to use absolute paths when I want to reference to images in Xcode (version 6.0.1). I am quite sure that I could place the images in my working directory which is something like:
/Users/patrikek/Library/Developer/Xcode/DerivedData/ChessGame-
ftpbqerfsenxxbfvneyzfwdmtwjk/Build/Products/Debug
Then add the file to some Xcode group in project navigator (eg. images/myImg.png) and I would be able to reference the file as myImg.png (since I have not foldered the image inside my working directory). I am also quite sure that the project navigator stuff would not b required for this to work.
And after this introduction comes the questions:
1) Is it necessary to place all images and other resources in the current working directory? Also, if not what is the best way to store folders in a program and is it necessary to name the folder containing images to Resources?
2) Is it possible to arrange files using the project navigator? What I am after is to use the project navigator only and let Xcode worry about the details of copying files and so. It seems somehow unnecessary to have a project navigator, when the physical files are not packaged in the same way. It does also seem error prone to update the project navigator and the physical hierarchy independently of each other.
An example:
I create a folder images in the Project navigator, inside that folder am I placing a reference to the image using the usual way in the project navigator. Is it now possible to make Xcode arrange so that I can do a call images/myImg.png when I want to load the image in some function (without me doing anything, since if I move many images to my working directory I may forget one and I may also spell images wrong by mistake if I create another folder in my working space). Also what have happened inside Xcode when this action was done?
Since I am not at all familiar with Xcode yet I may have got something wrong here, but the core of this problem is to find out where the files physical location must/should be and if there is some way to let Xcode do this by using the project navigator.
BR Patrik

Xcode does not manage images the way you have presumed that it does. Take a look at the 2013 WWDC "What's New in Xcode" video to see how Xcode 5 and Xcode 6 organize and manage images for any given project. When you have configured the asset catalogues for your project correctly, it wouldn't matter where the original images live on disk. As long as you have dragged the right assets into the right catalogues, your projects will work. The good news is that you only need to configure images once and change only the ones that change once done. For details, see this wwdc video: http://devstreaming.apple.com/videos/wwdc/2013/400xex2xbskwa5bkxr17zihju9uf/400/ref.mov
Once an image is configured in the asset catalogue, you can refer to it with or without it's file extension. For example, you can refer to "example.png" as "example" in your code. Hence, "myImg.png" can be "myImg" or "myImg.png" in code. No need to worry about which subdirectory contains it.
Now if your question has to do with runtime assets, again your development system directory structure would not matter. If that is the case, then you might have to re-ask your question. I would be glad to help you there as well--if that's what you want to know.

Related

How to organize a R project structure in interaction with using R-markdown

I've been reading everywhere about the need to organize your R projects and also to use Rmarkdown.
I see an incoherence I can't solve.
Suppose I set for the following standard organization:
Project
data
raw-data
code
docs
out
reports
and also home of setwd().
Now I want to use Rmarkdown with my main project file called My_project.Rmd
I create it at the root project level, then I get at every knit rendition 2 directories created My_project_cache and My_project_files on to of every .hml file rendered that conflicts with the above structure.
This is very impractical.
I tried setting the options of output to avoid this, per this tip, but it fails on the cache directory, and I did not succeeded in setting Knit options to bypass it. And no-one seems to be bothered by this question making the solution look like a dead-end.
The other solution is to put My_project.Rmd directly in reports/ but it feels a little awkward and on top of that it breaks the above project structure by imposing ../ paths everywhere.
The third solution is to work with Rmd format, only at the end of a project, but this seems a little defeating the purpose of documenting everything neatly in the first place.
There may be a 4th solution using R Notebook feature, but it works until you decide to try to finalize your "final" document , which of course is never really final.
What am I missing here ?
For reference, I'm using RStudio on a Mac.

Do I have to do something special to make a file a resource file in QT C++?

Basically I have an image I'm trying to use as a splash screen. I set up the splash screen and even told it the location(":/Nuclear_Vortex_100_About.jpg") but when I run the program, all I see is a general window background "window"(no close box or any of the decoration, just a widget for lack of a better word) and no image on it.
I added the file (along with a bunch of other images I want to later load and use in the app) and they show up in the "Other Files" folder - ok so I figured since they're in the project, that they would be seen as resources if not source or headers. Do I need to add a special section to the PRO file or something in order to use the file? I'm about to just hard code an absolute path just to get it to work but I want a system independent way to get this done. I'm going to be paid for this project and I don't have much experience with the resource system in QT but it wasn't hard in Visual Studio and other C++ environments. As I see the splash screen show up, I know that part is working. The only thing I don't know for sure is that the file is not being found - that is I have not verified by using QFile and checking if it exists - I'll be doing that after I post this as it'll take some time to get a response or 2.
I have been searching for over a day and a half all over google and haven't found anything telling me what I'm doing wrong.
Thank you!
create resource file (.qrc) and add picture in it. It'll appear in resources section of your project. Then you can use it freely in your program.

How to register Shell Thumbnail handlers

I am trying to define 2 custom filetypes that I want them to feature thumbnail previews within windows explorer and I used this code sample (https://code.msdn.microsoft.com/CppShellExtThumbnailHandler-32399b35) to register the new shell extension but I can only make one of them work at a time.
The moment I try to register the second one it seems it replaces the IThumbnailProvider's Handler Subkey {E357FCCD-A995-4576-B01F-234630154E96} and breaks the first filetype's registration. If anyone has some experience with this, my question is,
can I register more than 1 filetypes at a time using this code sample?
Is there an alternative?
Thank you!
I managed to register more than 1 custom files, but the way I did it leaves me baffled... So if anyone could take the time to explain it to me I d sure appreciate it.
I copied the c++ project/solution to a new folder, changed the custom filetype parameters inside the code to match my 2nd custom filetype needs, build this new project and registered the resulting .dll.
So basically, what made it work, is that when you build the project/ solution the files that are being produced (the .dll being just one of them) are essential for the thumbnail handler to work.
And this is what baffles me.
I would expect that after you register the .dll, the new filetype is established and that I could even get rid off the aforementioned files. But apparently not only you have to register the .dll, but also make sure you keep the other files that are being produced upon built, unchanged in everyway.
So that basically means, 1 project/solution per custom filetype, nicely saved in its own folder :)
Is this the right way to do this, or am I just hacking it here?

How to reference to images and other objects in Xcode and where to place them physically?

This question have been asked numerous times, but I have not managed to get an answer that I am happy with. Probably because the most answers is of "how do I do this?" type and also get "this way you do this" answers.
The problem I have is that I need to use absolute paths when I want to reference to images in Xcode (version 6.0.1). I am quite sure that I could place the images in my working directory which is something like:
/Users/patrikek/Library/Developer/Xcode/DerivedData/ChessGame-
ftpbqerfsenxxbfvneyzfwdmtwjk/Build/Products/Debug
Then add the file to some Xcode group in project navigator (eg. images/myImg.png) and I would be able to reference the file as myImg.png (since I have not foldered the image inside my working directory). I am also quite sure that the project navigator stuff would not b required for this to work.
And after this introduction comes the questions:
1) Is it necessary to place all images and other resources in the current working directory? Also, if not what is the best way to store folders in a program and is it necessary to name the folder containing images to Resources?
2) Is it possible to arrange files using the project navigator? What I am after is to use the project navigator only and let Xcode worry about the details of copying files and so. It seems somehow unnecessary to have a project navigator, when the physical files are not packaged in the same way. It does also seem error prone to update the project navigator and the physical hierarchy independently of each other.
An example:
I create a folder images in the Project navigator, inside that folder am I placing a reference to the image using the usual way in the project navigator. Is it now possible to make Xcode arrange so that I can do a call images/myImg.png when I want to load the image in some function (without me doing anything, since if I move many images to my working directory I may forget one and I may also spell images wrong by mistake if I create another folder in my working space). Also what have happened inside Xcode when this action was done?
Since I am not at all familiar with Xcode yet I may have got something wrong here, but the core of this problem is to find out where the files physical location must/should be and if there is some way to let Xcode do this by using the project navigator.
BR Patrik
Xcode does not manage images the way you have presumed that it does. Take a look at the 2013 WWDC "What's New in Xcode" video to see how Xcode 5 and Xcode 6 organize and manage images for any given project. When you have configured the asset catalogues for your project correctly, it wouldn't matter where the original images live on disk. As long as you have dragged the right assets into the right catalogues, your projects will work. The good news is that you only need to configure images once and change only the ones that change once done. For details, see this wwdc video: http://devstreaming.apple.com/videos/wwdc/2013/400xex2xbskwa5bkxr17zihju9uf/400/ref.mov
Once an image is configured in the asset catalogue, you can refer to it with or without it's file extension. For example, you can refer to "example.png" as "example" in your code. Hence, "myImg.png" can be "myImg" or "myImg.png" in code. No need to worry about which subdirectory contains it.
Now if your question has to do with runtime assets, again your development system directory structure would not matter. If that is the case, then you might have to re-ask your question. I would be glad to help you there as well--if that's what you want to know.

Wix multi-disc layout requirement - Caching and locating media

First time asking a question here, and might not be my last. This is in regards to WiX 3.8
My company is starting to go into the installer business, and one of the requirements I have been tasked to do is to create a multi-disc installation for our product. I have used WiX before for simple patches, but now we want to create a full installation. Some of the requirements include:
Creating external cab files for multiple discs [Which I enabled with setting the 'EmbedCab' property in the media tag to 'no' and setting the disc ID's to each file element with Compression to low]
The finished build will have the 5 discs in separate folders, with the respected external cab files in each [Media tag 'layout' set to destination]
Executing the .msi file inside the 'Disc1' folder [Which works...almost]
The problem I am running into is that when the .msi file is located on the hard disk, either outside the Disc layouts or inside the 'Disc1' subfolder, it cannot find the other .cab files. The requirement I have is that I need to find a way to be able to only prompt for a disc if and only if after searching inside the next subfolder 'Disc2' and finding the next .cab file to install. Therefore it can not only look in the root where the .msi is located, but also check the subfolders for the required cab files. (This almost mimic's InstallShield, but I REALLY don't want to go that route.)
The second issue I have is regards to the bootstrapper. The .exe file needs to embed the .msi file as per the requirement. However, even when disabling caching of the msi file, the bootstrapper seems to start caching all the other .cab files (we are talking about a 20GB installation). Even disabling repair and rollback, the bootstrapper continues to try to cache the cab files into the PackageCache area on my system.
I've looked online and read the WiX books to help find a solution, but I seem to finally hit a dead end. Can anyone give me any thoughts or insight to help with this issue?
Some things I have tried so far:
- Using a custom action (C++) to perform a 'ResolveSource' to try to change the 'SourceDir' property to continue installation
- Thought about making a custom bootstrapper to disable the package caching event entirely, but I have no idea where to start.
Any advice, direction or even a sample to help would be greatly appreciated.
Thanks!