How do I create resource packages with a filetype? NSBundles? - cocoa-touch

I am not sure what it is called, but I'm looking for a way to create packages (a directory containing a bunch of non-executable files, i.e. images) with custom file extensions. For example, I want to create a theme package named example.theme, which contains a bunch of images. How can I achieve this?

Just create a directory with that name. On iOS, there is no file manager, so you don't have to worry about it appearing as a bundle or just as a regular directory.

Related

How to mark package as a resource folder?

I have a dir structure for Intellij 12:
...
...test
- java
- com.mycompany.myproject
- package1 (contains code, etc,.)
- resourcePackage (want to contain .json files but can't mark as a resource)
- myOtherJunk.json
- o o o
- resources
- aResource.json
The thing is if I right click on my package name (com.mycompany.myproject) I can only add packages and not directories (like that of an existing resource folder).
However, I don't want to use that existing resource folder for the .json files that I'm going to read into per my test class.
So, I need something to support:
// this already works for the resources directory per the .json file but doesn't for the
// myOtherJunk.json per the resourcePackage.
InputStream is = MyClassTest.class.getResourceAsStream("aResource.json");
This can be solved in several ways. An example of a good approach would be the following folder structure:
src
main
java
resources
test
java
resources
When this is done, you put all you java classes under src/main/java/com.mycompany package and any resources under /src/main/resources/com/mycompany folder.
To link them together, go to the project properties, and find the Path tab. Mark the src/main/java and src/main/resources as source folders. (see the screen-shot attached)
If you link them together, you'll be able to use getResourceAsStream() method.
If you wonder why you should use the following folder structure - this is standard maven way of keeping things clean and tidy.
Directories Creation
Intellij creates directories when you ask her to create package. It is not an error.
If you create package "com", it will create the dir "com", and if you create a source file there, it will think that the file is in the package "com".
If you create package "com.next.pack", it will create three nested dirs "com", then "next", then "pack", and if you create a source file there, it will think that the file is in the package "com.next.pack".
Directories Structures
Only the path under the source root is taken as a package. Any directory(ies) can be set as a source root(s).
Resources roots
Make practically any structure of directories. Somewhere in it there is the root dir of resources. Right-click it and Mark Directory As ... Resources Root.
Notice, the same method can be used for the directories structures for tests, test classes, and test resources. Look here.
Please use #ContextConfiguration annotation to load the resource files. Please see below example.
#ContextConfiguration( { "/app-config.xml", "/test-data-access-config.xml",application-test.yml })

jars, external properties, and external file io

I checked quite a few similar questions, but so far I am unsatisfied with the solutions.
Ever use the Minecraft Server? At initial launch, it creates all the files and folders it needs, and allows you to make changes to files like Server.properties and ops.txt by making them external of the executable jar file.
I'm working on a similar project, and I want to duplicate that behavior. Everything works great when I run it in eclipse. When I export to a jar file though, things get funky. The external files and folders are created without a hitch, but afterword, it would appear as though they cannot be read from or written to. Any ideas how Notch made his server?
--edit--
Scratch that, it doesn't even appear to reliably create the files and folders. Maybe it only creates them the very first run after creation?
--edit again--
It creates them in the root directory. When I tested it in eclipse, the root directory was limited to the folder containing the project, and therefore looked fine. The solution was to make the class aware of it's location, and include it in all file operations.
Have the main class in your executable jar file look up where it is, then have it store that information in a global String or something. Prefix your filenames with that string in your file operations, and voila! It's writing to the correct directory.

Creating bundles in Cocoa

What is the best way to create an empty bundle in Cocoa? I bundle in OS X is really nothing but a folder, the only difference being that you have to right-click and do "Show Package Contents" to see the contents, right?
Well, I want a bundle in that sense. After that I will put some files of my choice into it, such as a bunch of plist files. The reason I want to do this is so that my file structure (in, say, the AppSupport folder) will look nicer at the root level.
Related question: How do I tell OS X that a folder ending with ".myappFoo" should be treated as a bundle?
The starting place for information is the Apple developer's doc Bundle Programming Guide.
The Finder considers a directory to be
a package if any of the following
conditions are true:
The directory has a known filename
extension: .app, .bundle, .framework,
.plugin, .kext, and so on.
The directory has an extension that
some other application claims
represents a package type; see
“Document Packages.”
The directory has its package bit set.
The .myAppfoo showing as a bundle is done as a Document Package

how to install new oracle apex theme?

I'm trying to install new apex theme but the problem is that I don't know where to put theme images folder in apache webserver?
I tried to put it on the apache/images but this doesn't work
So does anybody know where to put the images folder
Note: I have successfuly imported the .sql file and already switched the theme to the new one.
It depends on how the template references the image files.
By default in Apex, there is a substitution value called #IMAGE_PREFIX# that points to a folder called /i/. This folder, in turn, is just an alias set up in the Apache config (see the dads.conf file to determine the actual location).
Your template should reference images using #IMAGE_PREFIX#some_folder_name/some_file_name, in which case you need to put the images in a folder called "some_folder_name" beneath the directory that the /i/ alias points to.

PackageMaker Troubles

My PackageMaker project was generating a .mpkg file, but then, all of the sudden, when I go to build, it only generates .pkg files. The .mpkg files are actually directories into which I place my custom installer bundle along with an InstallerSections.plist file to specify the order in which my custom view should display. The .pkg files are not directories and I have no way to add my custom installer bundle to it.
Anyhow, something is awry as PackageMaker no longer lets me generate a .mpkg file. Any idea why that might be? Is there some other way I should be approaching this?
Thanks.
p.s. If you are thinking of suggesting I ought to check out this tutorial, please don't bother. It's way out of date. Thanks.
Your pmdoc is a distribution project, and you've set the pmdoc's minimum system version to 10.5. PackageMaker always generates flat packages in this case.
There are three solutions:
Choose “Install Properties…” from the Project menu, and set the pmdoc's minimum system version to 10.4. This is the go-back-to-.mpkg solution.
Use the Flat Package Editor (hidden inside the PackageMaker bundle) to add the custom installer bundle. The contents of a .pkg file are the same as, and lain out similarly to, those of a .mpkg bundle.
Since flat packages are xar archives, use xar to extract the contents of the .pkg file to a temporary directory, add the custom installer bundle in that directory, then use xar to re-assemble the .pkg file from the temporary directory.