The Xcode docs for this don't explain exactly where each of the Destination paths maps to on disc, relative to my application package.
If I use this app as an example, could someone give a canonical answer where each will put files relative to this directory structure?
The app bundle in your example is Viewer. This is not a file; it's a directory. If you click on it and "Show Package Contents", you'll see the rest of it.
Products Directory is the directory that Viewer is written to. You cannot write to this directory in iOS.
For iOS, Wrapper is the top level directory within Viewer.
For iOS, Executable is the same directory as Wrapper.
For iOS, Resources go into either the Wrapper directory, or the localization directories (Base.lproj, etc) if the resource is localized.
The other directories aren't meaningful for iOS.
Still, you should use the directories logically. Use "Executable" to mean "the directory where my executable lives." Don't assume that the directory tree is laid out a particular way internally.
Regarding your comment that you need to know the path to access the file, you do not need that (and shouldn't try). You should use [NSBundle pathForResource:ofType:] to find files.
Related
I'm trying to load image with IMG_Load() function from SDL.
I saw from tutorials that they doesn't need full path for asset files.
But when I try to do that, it doesn't work.
My solution is include full path of those files, but I found that is clunky. Especially when I try to collaborate with my friend, it's hard to synchronize source files since we use different file paths.
May I ask what is typical way to collaborate between programmers when they have different setup, different file paths? I think that I need to simplify the file path for asset.
I tried to add include directories for compiler, but it only work with header files, not for asset files.
Relative paths are relative to the current working directory. On Windows, when starting a program from the exporer with a double-click, it matches the location of the .exe, but this isn't always the case, e.g. when running from some IDEs.
Use SDL_GetBasePath() to get the directory where the .exe is located. Prepend it to your asset paths.
I would like to get your thoughts on why I am getting an "unresolved inclusion" error for certain .h files included as part of my project.
I actually cloned the project from another existing project, by simply copying, pasting and renaming.
Inside the cloned project, which originally had only a src/ directory, I also created a tst/ directory and did right-click->New->Folder and from the menu, clicked on Advanced >> and selected "Link to alternate location (Linked Folder)" and browsed to the relevant path under /vobs to add the source folder to my project.
Once I did this, the indexer started rebuilding the index, at the end of which I got the above mentioned inclusion errors.
The .h files could be located inside a specific folder path under /vobs; I first tried including this path by right-clicking on the cloned project and choosing Properties->Paths and Symbols->Includes to update the include list with the folder path. This didn't resolve the error.
Subsequently, I tried repeating the above procedure for the newly created tst/ directory from within the project; that didn't resolve the error either.
Not sure what is it that I am missing here.
Any suggestions would be appreciated.
Check first if those files are there, in your view. '/vob' could mean dynamic view, mounted under /vob.
I would rather work with a snashot view, which would download those same files on disk (rather than using the MVFS, Multi-Version FileSystem of a dynamic view).
Then, when you are sure the files are there, and cleartool ls shows them correctly loaded, you can double-check your inclusion paths, as mentioned here
"unresolved inclusion" means the file can't be found.
This means the directory containing it hasn't been specified to CDT or it has been misspelled.
If spelled correctly, normally you would specify the path with Project --> Properties --> C/C++ General --> Preprocessor Include Paths, Macros etc. on the Entries tab as a user entry.
Note that it depends on the type of project.
When you select File --> New -> C/C++ Project you are presented with various options.
The options are for the kind of builder used.
Some, such as Meson, Qt , Arduino and maybe others don't have the option "Preprocessor" option.
My guess is that you are not set in a view when you start Eclipse. This will prevent resolution of the the absolute "/vobs/..." paths. If you start Eclipse from GNOME (or any other windowed environment) the current working directory of Eclipse is likely your home directory. Without a view context, the /vobs/... paths will not contain any files under source control.
You COULD use /view/myview/vobs/myvob/... in the include paths, but that would mean EVERYONE who would use the project would have to either start your view or create and start an identically named one... And that's just the start of that particular can of worms.
You may want to confirm how Eclipse handles relative paths in the include path. Do they start from the current working directory of Eclipse? The project home directory? Somewhere else? That may give you a safe view-independent way to specify your include paths.
I would try setting a view and starting Eclipse from within the subshell spawned by cleartool setview. Then verify whether the includes are accessible.
I am creating some software with C++ and Cmake that I want people to be able to effortlessly build and run. Cloning the GitHub repo will install the folder Project/, and the code in the file Project/src/navigation/camera/image.cpp compiled into and linked to multiple programs all over the Project repository. However, inside image.cpp there is a path to a file Project/Models/model.txt, and the file path is relative to Project/build/navigation/camera/image.o:
image.cpp:
int processImage() {
read_file("../../../Models/model.txt");
// Do something
}
But since the object file is linked to other programs all over the project, the path should be relative to many different locations. What is the standard "Software Engineering" technique to solve this? Do you tell Cmake the path of Project/, and somehow let it modify image.cpp before building? Or is there a way to still use relative paths?
If you are using CMake, the typical build model separates the source tree from the build tree, which means that your build folder could be anywhere relatively to the source folder. Therefore, any relative path wouldn't work reliably.
If I can't avoid having an hardcoded path in the source, my favourite solution is to pass your cpp file to the configure function of CMake to replace that relative path to an absolute path that CMake will calculate at generation time
I don't know how "standard" this approach is, but what I would expect is a requirement that Models be a subdirectory of whatever directory the executable is executed from. Usually this is wherever the executable ends up, but not necessarily. For released projects, this directory is usually (expected to be) the installation directory. There is a caveat that other functions are capable of changing the current working directory, and that would make it more difficult for your code to find model.txt. So I would also expect a requirement that the current working directory be restored before your code is run.
If you go this route, the relative path to your data file would be Models/model.txt. It would be up to each project to copy this data to the appropriate directory (or create a link from the directory to the data file). Note that each project would probably want this configuration for release anyway since you usually should not (sometimes cannot) access the parent of your install directory.
I am making an application in Qt. I have 2 directories, 1 for configurations, the other for program scripts.
I would like to have it say that when I build the project, it will place those directories in a certain directory.
For instance on linux:
/home/username/.project_name/configurations
/home/username/.project_name/scripts
This should also be cross platform, so on Windows and MacOS these files should be placed in the normal place where application data is stored.
Is there there a way to specify where these directories (and the files in them) should be placed? Is it an option in the project file? And which option ?
The qt resource system is used to store files within your application's executable.
You need to answer two questions:
Where do the files come from? Does your installer or package contain them, or are they in the executable proper and the application extracts them and saves them. Then the qt resource system is useful.
How to get the path you need to create your configuration directory. QDesktopServices::storageLocation(QDesktopServices::DataLocation) returns such a path in a cross-platform manner.
So I'm playing around with an ActionScript library (Flare, to be specific) in Flex Builder 3. I'd like to have this functionality available to all projects in my workspace without having to copy it to every one. What's the easiest way to do this?
I'm not sure this is the best way, but you can link to a folder or file from within a project. You right-click on the project, and choose "New <whatever>" and click on the Advanced button to access the link functionality. From there, you can use the file navigator to choose a file or folder. Afterwards it will show up in the project properties under the build path (the tab for library paths).
We use this because we split off a large chunk of our code into a separate library project, but that code still references a ton of image files in the original projects root directory. So we create a link to that image directory and all is well again. Maybe this will help you also.
We have a shared folder "flex" that we place our common libs. In the properties for the project, under flex build path, set the library path to your location for flare.