In my game, rather than copying and pasting the existing images over and over again, I prefer to use shortcuts of images. However, each shortcut is 2.6mb which is bigger than most images. Is there a way to fix this issue? Cheers..
The full explanation is given in the Apple developer document "File System Programming Guide":
https://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/AccessingFilesandDirectories/AccessingFilesandDirectories.html#//apple_ref/doc/uid/TP40010672-CH3-SW10
In short, what the original poster called a shortcut is properly called a bookmark; it is created using methods in class NSURL (or CFURL functions). When written to disk, it is called an alias file, as in the old days of the Mac. Filesystem bookmarks/alias files have a similar function to symbolic links, but they are far from being the same thing.
Symbolic links
are provided at the Unix filesystem level
contain no data other than a pathname
are fragile if the destination file is moved
require no application code to interpret, since the Unix kernel handles them
Alias files
are specific to OS X, implemented by the Core Foundation and Foundation frameworks
can be very large, especially when pointing to image data (on Mac as of OS X 10.7)
are self-repairing if the destination file is moved (within certain limits)
require the use of NSURL or CFURL routines to interpret
If you wish to create a Unix symlink from your code, use the symlink system call. See https://developer.apple.com/library/ios/#documentation/System/Conceptual/ManPages_iPhoneOS/man2/symlink.2.html#//apple_ref/doc/man/2/symlink
Related
How can I change a file type?
A year ago I wrote a few articles that should be viewed in any text type of program. however, I recently opened them and they are viewed in symbols and alphanumeric characters. In linux os, the 'file' is now in an archived folder type that contains .xml files. in windows os it is 'file' as type of file. it has no extension.
Is there any way to recover the original readable alpha-numeric information in these files?
My preference would be to salvage the original information than redo.
First off the extension doesn't actually mean anything for the information of the file, it's only purpose is as a hint to the OS for deciding which application should be used in opening the file. You can prove this by renaming something like an exe to have a txt extension which will then open in notepad as a lot of seemingly random characters; renaming it back to exe will allow it to run again.
Based on your description the files you mention are some form of binary file, the bad news with that is you need to know either what application was used to create the file in order to be able to open it or what the original file extension was (which would be a hint to the former).
If you don't know either of those pieces of information you can of course use trial and error by guessing what extension it might be, renaming it, then opening it with the associated application and seeing if it worked.
I have a corrupted 7-zip archive that I am extracting manually using the method outlined by Igor Pavlov at this link. An intermediate result is a large file that is a bunch of files cat'ed together that must be separated manually. I understand that some file formats will need to be extracted manually by a human using discretion (text files, etc.) but many file formats encode the size of the file as part of the file itself (e.g. .zip). Furthermore, some files can be parsed and their size can be deduced with just a little information about the file format (e.g. .pdf). Let's say the large file consists of the following files concatenated together:
Key: <filename>(<contents>)
badfile(aaaaaaaaaaabbbbbbbbbcccccccdddddddd) -> zip1.zip(aaaaaaaaaaa)
badfile2(bbbbbbbbbcccccccdddddddd)
I am looking for a program that I can run on a large file (call it badfile) that can determine the type and size of the first logical file (let's say it's a .zip file) contained within and create a new file to hold the contents (e.g. zip1.zip since filenames are lost) and chop the file off the front of badfile. This would allow me to run the program in a loop to extract files with known types and/or pause and let the user handle the difficult cases. Does such a program exist? I know that the *nix command file(1) will do a lot of the work here, but there would be a lot of effort in encoding rules for sizing files (e.g. .pdf) that I would prefer to not duplicate.
I believe this question should be closed due to being off topic as it asks to find existing programs to solve the problem, but open bounty prevents close vote. However.
Does such a program exist?
Yes they exist is and are called data carving tools.
Some commom ones include scalpel and foremost and PhotoRec
A list of other tools is avaliable here
In numerous places, the Apple documentation talks about packages of files (e.g. for iCloud) created by NSFileWrapper. Is this is any way similar to the .pkg format used to hide a folder as a single file on the OS X platform?
I have an app with multiple text files that I'd like to be able to let the user backup. I've used NSFileWrapper to create a single 'file' that does this. I had assumed that this was similar to a .pkg file on OS X, but despite then bringing the file into OS X (via email) I have no way of opening it - despite renaming files, etc.
So, is the NSFileWrapper 'package' completely different to the OS X 'package'?
Thanks,
Richard
No. One works on the filesystem level, while the other is a bunch of files compressed together with a specirfic set of unpacking instructions
NSFileWrapper, From the link you mentioned:
A file wrapper is a runtime representation of a file-system node, which is either a directory, a regular file, or a symbolic link.
While a .pkg would look something like:
A xar-based format used on a number of platforms to install files.
Wikipedia, (un)surprisingly enough, has a decent overview of what exactly a .pkg is.
I just realized that Bundle Creator OS Type code in my iOS app's Info.plist value is ????? in Xcode 4. What is the value supposed to be?
It's used to identify your application. You don't have to change it for an iPhone application.
Take a look at these links:
Information Property List Key Reference
Mac Creator and File Type Codes
Data Type Registration
It's not really used anymore.
It's a holdover from the Classic Mac OS days
when it was a datapoint used mainly to determine what apps could create or edit or read file types.
Back then you had to register them with Apple.
I don't think they even provide that service any more.
OS X and some apps might still use it in rare cases under the hood but its very legacy.
As you can imagine, the severely limited possible permutations made it untenable long term.
UTIs are the preferred approach now. The system then uses a combination of these and file extensions and magic numbers. Though on ios that may not be true as much as OSX.
It is just the four letter code to identify the bunder creator... for example for apple it is APPL...
It can be ???? or if your app name is "myApp" you can give "MYAP"... If you have many apps you can give first 2 characters with your app name and next 2 characters with company name...
For example apple uses CF for core foundation, AV etc
http://developer.apple.com/library/ios/#documentation/general/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
Just to give the historical perspective on extensions and file type and creator codes.
File extensions were part of the file system in CP/M and were intended to function something like what file types and creator codes actually did in MacOS. At the time, it was expected that each application would use a unique extension and only the one application would ever edit its own files. In the file system, the file name and extension were stored in two different areas, so the extension was not part of the name. Remember, at that time most systems had only a few applications, and file contents were specific to an application. They were never intended to be visible to end users, but due to an error in the directory command in CP/M, they were shown displayed as if they were part of the file name. MS-DOS picked up the convention, and the rest, unfortunately is history.
Apple's initial file system design saw the shortcomings of the extension concept, the primary one being that some file types were likely to be used by more than one application and with standardization of file formats, having more than one application that could operate on a file would be common. Therefore Apple split the file creator - the app that created the file - from the file type. By default if a file was double clicked, the originally creating application would open it. However, if a user did a file open from within an application, then all compatible files were supposed to be listed, even if that app was not the creator. Also, it would be possible to list all the applications that could open a file. Semantically, as intended in CP/M, the type and creator codes were separate from the file name itself.
Developers that properly registered their applications with Apple got their own creator codes. The problems with this concept came about from two sources: 1. Developers that hijacked other's or Apples own creator codes. 2. Unix systems, which never had a formal filename extension (all file names were a single string) began adopting the convention to end the file name with a dot and some additional letters to indicate file type. In the Unix convention, the extension is part of the file name itself, unlike CP/M and MS-DOS.
I have an nascent iPad application, which stores "documents" internally on the device in the file system as a series of distinct files in a folder.
I'd like to try incorporating an import/export function through iTunes, using the features for OS 3.2 for this. I want to put all the document pieces that I keep internally into one container file for export.
So, smart folks of Stack Overflow: What's the simplest solution that will put a file hierarchy (or could be flat list in a pinch) into one file? There will not in theory need to be manipulation of the "archive"/container outside the app-- so random access isn't super important here, although it would be a bonus of course.
A tar file type thing springs to mind immediately. Roll my own? Any other thoughts or gotchas? (And if anyone can point me to code that reads/writes from a tar file, I'm all ears.)
Thanks!
Update: Made community wiki, since there's no single right answer here.
Try libarchive which is a friendly licensed, BSD derived (easier for iPhone OS) library for handling archive files.