A resource fork is a fork of a file on Apple's classic Mac OS operating system that is used to store structured data. It is one of the two forks of a file, along with the data fork, which stores data that the operating system treats as unstructured. Resource fork capability has been carried over to the modern macOS for compatibility.
A resource fork stores information in a specific form, containing details such as icon bitmaps, the shapes of windows, definitions of menus and their contents, and application code (machine code). For example, a word processing file might store its text in the data fork, while storing any embedded images in the same file's resource fork. The resource fork is used mostly by executables, but any file can have a resource fork.
In a 1986 technical note, Apple strongly recommended that developers do not put general data into the resource fork of a file. According to Apple, there are parts of the system software that rely on resource forks having only valid Resource Manager information in them.[1]
The resource fork was conceived and implemented by Apple programmer Bruce Horn.
The resource fork has three purposes in classic Macintosh file systems:
The resource fork is implemented in all of the file systems used for system drives in the classic Mac OS (MFS, HFS and HFS Plus), and in the macOS-only APFS. The presence of a resource fork makes it easy to store a variety of additional information, such as an icon that the desktop should display for that file. While the data fork allows random access to any offset within it, access to the resource fork works like extracting structured records from a database. (Microsoft Windows also has a concept of "resources", but these are completely unrelated to resources in Mac OS.)
The Macintosh file systems store metadata distinct from either the data or resource fork, such as the creation and modification timestamps, the file type and creator codes, and fork lengths.
Some files have only a resource fork. One example is a font file in the classic Mac OS. Another example is a Classic 68k application, where even the executable code is contained in resources of type 'CODE'. Later PowerPC binaries stored the executable code in the data fork.
Since resource forks were supported only on Macintosh file systems including MFS, HFS, HFS Plus, and APFS, they could not be copied to the file systems of other operating systems. The Mac BinHex and MacBinary formats were invented to encode resource and data forks into one file, for transfer between systems. A/UX supported resource forks on Unix file systems via the AppleSingle and AppleDouble formats. Starting with Mac OS X Tiger, AppleDouble was used to store resource forks on file systems such as Windows SMB shares and FAT32 (File Allocation Table) volumes.
In the HFS Plus file system, settings can be made to allow other forks in addition to the data and resource forks, to create a "multi-fork" application.[2]
As of August 7, 2002, Apple recommended that developers should not build resources into resource forks in Mach-O binaries on Mac OS X.[3]
Each resource has an OSType identifier (a four byte value), an ID (a signed 16-bit word), and an optional name. There are standardized resource types for dialog boxes (DITL), images (PICT), sounds (snd ) – and executable binaries (CODE) which, until the advent of the PowerPC processor, were without exception stored in the resource fork. Subroutines for rendering windows are stored in their own type of resources (WDEF), and subroutines for rendering menus in theirs (MDEF). This arrangement enabled users to easily customize not only individual applications but also the operating system itself, using tools such as ResEdit to modify the resources of an application file or any of the system files.
DITL
PICT
snd
CODE
WDEF
MDEF
Within an application or other code, resources can be loaded simply using a combination of their type, ID or name, without regard to how and where they are stored in the resource fork. The client is returned a handle to the loaded resource which can then be accessed like any other heap-based data. The OS component that facilitates this is the Resource Manager. In addition to abstracting the details of the data storage from the data, the Resource Manager also arranges sets of open resource forks into a stack, with the most recently opened file on top. When trying to load a resource, it will look in the top of the stack first, (perhaps the current document's resource fork), then the next one down (the application's resource fork), then the next one (system resource forks). This arrangement is very powerful – it permits local resources to override more global ones lower down – so an application can provide its own icons or fonts in place of the standard system ones, for example. It also allows an application to load resources from the system using the same API as any other resource, without regard to where or how that resource is stored – to the application, all resources are equally available and easy to use. The system reserves resource IDs in a certain range to help avoid resource conflicts arising from this. Resource Manager APIs allow the programmer to manipulate the stack and modify the search behaviour.
As the resource fork can be edited with a resource editor such as ResEdit, it can be used to localize and customize software. In addition, most resource editors allow visual editing of data. In macOS, it is possible to use resources when developing an application. However, if the application may need to be used in UFS, it is also possible to configure it so that the entire resource fork is moved to the data fork, using the Raw Resource File setting[citation needed]. The integrated development environments distributed for free by Apple Inc., which include MPW and Apple Developer's Tools, include a compiler called Rez. This uses a dedicated language, also called Rez, which can be used to create a resource fork by compiling source code. A decompiler, DeRez, which can be used to change a resource fork back into Rez code is also included.
In the structure of the resource fork, there is a piece of data called a "resource map" which stores the positions of resource data items. This can be used to allow random access to resource data based on the defined IDs and names. The resource fork can be thought of as consisting of essentially two objects, the resource map and the resource data itself, but in fact each data type is a hierarchical structure which stores multiple items of data. The format in which the information in the resource data is stored is defined based on the types of information, which are known as "resource types." Resource data often makes references to other types of data.
In macOS, forks are named file/..namedfork/forkname, e.g., the resource fork of the file IMG_0593.jpg is IMG_0593.jpg/..namedfork/rsrc. The ls command supports a -l@ option which lists a file's forks.
ls
-l@
Resource forks appear as the extended attribute com.apple.ResourceFork.[4]
Previously resource forks were accessed via the 'Resource Manager' API. This API is now deprecated.[5]
Under the deprecated API:
File Manager APIs such as PBOpenRF() also allowed access to the raw resource fork; however, they should be used only for applications such as copying a file – Apple strongly warns against using the resource fork as a "second data fork."
PBOpenRF()
From the POSIX interface, the resource fork could be accessed as filename/..namedfork/rsrc or as filename/rsrc; the shorter form was deprecated in Mac OS X v10.4 and removed completely in Mac OS X v10.7.[6]
filename/..namedfork/rsrc
filename/rsrc
The smallest elements making up a resource fork are called data types. There are several data types. After a resource fork is accessed, its contents can be found by reading it in as appropriate for the data types defined in advance. Placing definitions inside the program stating how data is to be treated makes it possible to store resources called TMPL resources as well. Using this method increases the visibility of the data when viewed with a program such as ResEdit, making later editing simpler. As the Macintosh platform originated with Motorola-based processors (68k and PPC), the data is serialized to disk in big-endian format.
The following is a list of the major data types, in alphabetical order.
The type codes below, like the above datatypes, are used as type identifiers for more than resource forks themselves: they are used to identify file themselves, to describe data in the clipboard, and much more.
Types must be 4 bytes long, so types like snd and STR actually have a space (0x20) at the end.
The complexity of programming with resource forks has led to compatibility problems when accessing other file systems via file sharing protocols such as AFP, SMB, NFS and FTP, when storing to non-HFS volumes, or when transmitting files to other systems in other ways (such as via email). The AFP protocol natively supports Resource Forks, and so resource forks are typically transmitted to these volumes as-is, and stored by the server transparently to clients. The SMB protocol supports a file metadata system similar to Macintosh forks known as Alternate Data Streams (ADSes hereafter). macOS did not support storing resource forks in ADSes on SMB volumes by default until Mac OS X v10.6. In previous versions of the OS, including upgraded versions of 10.6, this feature can be enabled with a param change or by creating a special file.[9]
Networked file sharing protocols such as NFSv3 and FTP do not have a concept of file metadata, and so there is no way to natively store resource forks. This is also true when writing to certain types of local file systems, including UFS, and on SMB volumes where Alternate Data Stream support is not enabled. In those cases, macOS stores metadata and resource forks using a technique called AppleDouble, in which the data fork is written as one file, and the resource fork and metadata are written as an entirely separate file preceded by a "._" naming convention. For example: ExampleFile.psd would contain the data fork, and ._ExampleFile.psd would contain the resource fork and metadata.
Compatibility problems can arise because macOS will handle storage of resource forks differently, depending on macOS version, settings, and file system type. For example, on an SMB network with a mixture of 10.5 and 10.6 clients. A freshly installed 10.6 client will look for and store resource forks on an SMB volume in ADSes, but the 10.5 client will (by default) ignore ADSes and use AppleDouble format to handle forks. If a fileserver supports both AFP and NFS, then clients using NFS will store files in AppleDouble format, whereas AFP users will stored the resource fork natively. In those cases, compatibility can sometimes be maintained by forcing clients to use, or not use, AppleDouble format.
Many fileservers providing AFP support do not natively support resource forks on their local file systems. In those cases the forks may be stored in special ways, such as specially named files, special directories, or even Alternate Data Streams.
Another challenge is preserving resource forks when transmitting files using non-resource fork-aware applications or with certain transfer methods, including email and FTP. A number of file formats, such as MacBinary and BinHex, have been created to handle this. Command-line system tools SplitForks and FixupResourceForks allow manual flattening and merging of resource forks. In addition, a file server seeking to present file systems to Macintosh clients must accommodate the resource fork as well as the data fork of files; UNIX servers providing AFP support usually implement this with hidden directories.
SplitForks
FixupResourceForks
Older applications written with the Carbon API have a potential issue when being ported to the current Intel Macs. While the Resource Manager and operating system know how to deserialize data correctly for common resources like 'snd ' or 'moov', resources created using TMPL resources have to be byte swapped manually to ensure file interoperability between PPC and Intel-based versions of an application. (While the resource map and other implementation details are big-endian, the Resource Manager by itself does not have any knowledge of the contents of a generic resource, and so cannot perform the byte swapping automatically.)
moov
Until the advent of Mac OS X v10.4, the standard UNIX command-line utilities in macOS (such as cp and mv) did not respect resource forks. To copy files with resource forks, one had to use ditto or CpMac and MvMac.
cp
mv
ditto
The concept of a resource manager for graphics objects, to save memory, originated in the OOZE package on the Xerox Alto in Smalltalk-76.[10] The concept is now largely universal in all modern operating systems. However, the concept of the resource fork remains peculiar to the Macintosh. Most operating systems used a binary file containing resources, which is then "tacked onto" the end of an existing program file. This solution is used on Microsoft Windows for instance, and similar solutions are used with the X Window System, although the resources are often left as a separate file.
The Windows NT NTFS can support forks (and so can be a file server for Mac files), the native feature providing that support is called an alternate data stream. Windows operating system features (such as the standard Summary tab in the Properties page for non-Office files) and Windows applications use them and Microsoft was developing a next-generation file system that has this sort of feature as basis.
Early versions of the BeOS implemented a database within the file system, which could be used in a manner analogous to a resource fork. Performance issues led to a change in later releases to a system of complex file system attributes. Under this system resources were handled in a fashion somewhat more analogous to the Mac.
AmigaOS does not use forked files. Its executable files are internally divided into a modular structure of large pieces (hunk) capable of storing code, data, and additional information. Similarly, data and project files have a chunk structure codified in the IFF standard. Other file types are stored similarly to other operating systems. Though not strictly a resource fork, AmigaOS stores meta data in files known as .info files. .info files can be identified by the .info extension; for example, if you save a project to a disk, two files will be saved, MyProject and MyProject.info. MyProject would be the actual project data and MyProject.info would contain the project icon, information regarding which program is needed to open the project (since there is no application binding in AmigaOS), special project options and any user comments. .info files are invisible on the Amiga's desktop (Workbench). The icon on the desktop, taken from the .info itself, is the interface metaphor through which the user interacts both with the project itself and its associated .info file. A dialog box accessible by right-clicking the icon allows the user to see and modify the metadata present in the .info file. .info files can be seen as individual files in the command-line interface or a File manager. Modern AmigaOS clones (AROS, MorphOS and AOS4) inherit the structure (complete with metadata) of the .info files of older AmigaOS versions, and can also accept standard PNG graphic files as icon bitmaps in their .info files.
.info
MyProject
MyProject.info
NeXT operating systems NeXTSTEP and OPENSTEP, their successor, macOS, and other systems like RISC OS implemented another solution. Under these systems the resources are left in an original format, for instance, pictures are included as complete TIFF files instead of being encoded into some sort of container. These resources are then placed in a directory along with the executable code and "raw data". The directory (called a "bundle" or "application directory") is then presented to the user as the application itself. This solution provides all of the same functionality as the resource fork, but allows the resources to be easily manipulated by any application – a "resource editor" (like ResEdit) is not needed. From the command-line interface, the bundle appears to be a normal directory. This approach was not an option on the classic Mac OS, since the file system (MFS) did not support separate catalog directories. When catalog file support was included in Mac OS, with the HFS filesystem, the resource fork was retained. macOS does retain the classic Resource Manager API as part of its Carbon libraries for backward compatibility. However, the resources themselves can now be stored in separate data files within the file system – the Resource Manager now hides this implementation change from the client code.
1996 single by Bryan Adams StarSingle by Bryan Adamsfrom the album 18 til I Die ReleasedNovember 11, 1996 (1996-11-11)[1]Length3:42LabelA&MSongwriter(s)Bryan Adams, Robert John Mutt Lange, Michael KamenProducer(s)Bryan Adams, Robert John Mutt LangeBryan Adams singles chronology Let's Make a Night to Remember (1996) Star (1996) 18 til I Die (1997) Star is a song co-written and performed by Canadian rock singer Bryan Adams. It was released in November 1996 as the third s…
American pool player (born 1951) Allen HopkinsBorn (1951-11-18) 18 November 1951 (age 71)Elizabeth, New JerseySport country United StatesNicknameYoung HoppeProfessional1971Best finishQuarter finals 1990 WPA World Nine-ball ChampionshipTournament winsOther titles50World ChampionStraight Pool (1977) Allen Hopkins (born November 18, 1951) is an American professional pocket billiards (pool) player, professional billiards color commentator and BCA Hall of Fame inductee. He promotes multiple…
International athletics championship event2013 French Athletics ChampionshipsThe men's 200 m raceDates12–14 JulyHost cityParisVenueStade Sébastien CharlétyEvents38← 2012 2014 → The 2013 French Athletics Championships was the 125th edition of the national championship in outdoor track and field for France. It was held on 12–14 July at the Stade Sébastien Charléty in Paris. A total of 38 events (divided evenly between the sexes) were contested over the three-day competition. Re…
Levon AronianAronian pada tahun 2019LahirLevon Grigori Aronian6 Oktober 1982 (umur 41)Yerevan, Armenian SSR, Uni SovietSitus webwww.levonaronian.com Asal negaraArmeniaJerman (2003−2004)[1][2]GelarGrandmaster (2000)Rating FIDE2782 (Agustus 2021)Rating tertinggi2830 (Maret 2014)PeringkatNo. 5 (Agustus 2021)Peringkat tertinggiNo. 2 (Januari 2012) Levon Aronian (lahir 6 Oktober 1982) adalah pecatur putra Armenia. Pada April 2006 dalam daftar FIDE, ia ber-el…
Den här artikeln behöver fler eller bättre källhänvisningar för att kunna verifieras. (2021-02) Åtgärda genom att lägga till pålitliga källor (gärna som fotnoter). Uppgifter utan källhänvisning kan ifrågasättas och tas bort utan att det behöver diskuteras på diskussionssidan. SjukhusmordenGenreThrillerRegissörStephan ApelgrenProducentLars Blomgren Tomas MichaelssonManusAntonia PykSkådespelarePeter Haber Mikael Persbrandt Ingvar Hirdwall Rebecka Hemse Måns Nathanaelson Jonas …
Amt Britz-Chorin-Oderberg in Brandenburg - district Barnim locator map Amt Britz-Chorin-Oderberg is an Amt (collective municipality) in the district of Barnim, in Brandenburg, Germany. Its seat is in the town Britz. It was formed on 1 January 2009 by the merger of the former Ämter Britz-Chorin and Oderberg. The Amt Britz-Chorin-Oderberg consists of the following municipalities: Britz Chorin Hohenfinow Liepe Lunow-Stolzenhagen Niederfinow Oderberg Parsteinsee Demography Development of Population…
Artikel ini tidak memiliki referensi atau sumber tepercaya sehingga isinya tidak bisa dipastikan. Tolong bantu perbaiki artikel ini dengan menambahkan referensi yang layak. Tulisan tanpa sumber dapat dipertanyakan dan dihapus sewaktu-waktu.Cari sumber: Pondok Pesantren Matholi'ul Anwar – berita · surat kabar · buku · cendekiawan · JSTOR PP Matholi'ul AnwarInformasiJumlah kelasUla : 8 RB, Wustho : 8 RB, Unggulan dan Akselerasi : 6 RBKur…
العلاقات الأفغانية الأندورية أفغانستان أندورا أفغانستان أندورا تعديل مصدري - تعديل العلاقات الأفغانية الأندورية هي العلاقات الثنائية التي تجمع بين أفغانستان وأندورا.[1][2][3][4][5] مقارنة بين البلدين هذه مقارنة عامة ومرجعية للدولتين: وجه ا…
Olympia-Schießanlage Hochbrück, 300 m Außenanlage Die Olympia-Schießanlage Hochbrück im Garchinger Stadtteil Hochbrück ist die größte zivile Schießsportanlage der Welt und gilt als eine der modernsten Austragungsstätten für die olympischen und nichtolympischen Disziplinen des Sportschießens. Sie wurde für die Olympischen Spiele 1972 auf einem ehemaligen Standortübungsplatz der Bundeswehr errichtet. Inhaltsverzeichnis 1 Geschichte 2 Anlagen 3 Weblinks 4 Einzelnachweise Geschichte Au…
Province House Die Legislativversammlung von Prince Edward Island (engl. Legislative Assembly of Prince Edward Island) ist die Legislative der kanadischen Provinz Prince Edward Island. Sie tagt im Province House in Charlottetown. Die Legislativversammlung besteht aus 27 Mitgliedern, die in ebenso vielen, ungefähr gleich großen Wahlkreisen nach dem Mehrheitswahlsystem gewählt werden. Somit besitzt Prince Edward Island das kleinste Provinzparlament Kanadas. Der Anführer der Mehrheitspartei ist…
Agroforestry food production system modeled on woodland ecosystems This article may require cleanup to meet Wikipedia's quality standards. The specific problem is: heavy wikilinking, unnecessary attributions, OR, copy vios. Please help improve this article if you can. (July 2023) (Learn how and when to remove this template message) Robert Hart's forest garden in Shropshire Forest gardening is a low-maintenance, sustainable,[1] plant-based food production and agroforestry system based on …
Wakil Bupati BuolPetahanaH. Abdullah Batalipu, S.Sos., M.Si.sejak 12 Oktober 2017Masa jabatan5 tahunDibentuk2002Pejabat pertamaAli Nouk, B.A.Situs webbuolkab.go.id Berikut ini adalah daftar Wakil Bupati Buol dari masa ke masa. No Wakil Bupati Mulai Jabatan Akhir Jabatan Prd. Ket. Bupati 1 Ali NoukB.A. 2002 2007 1 Drs. H.Abd. Karim HanggiApt. 2 H.Ramli KadadiaS.E. 2007 2012 2 H.Amran H. Abdullah BatalipuS.E., M.M. 3 Dr. Ir. H.Syamsudin KoloiM.S. 10 Oktober 2012 28 Oktober 2016 …
هذه المقالة بحاجة لصندوق معلومات. فضلًا ساعد في تحسين هذه المقالة بإضافة صندوق معلومات مخصص إليها. التانترا من الكلاتشاكرا هو أساس علم الفلك التبتي. وهو يفسر بعض الظواهر بطريقة مماثلة لعلم الفلك الحديث. وبالتالي، يوصف كسوف الشمس بأنه مرور القمر بين الشمس والأرض.[1] في عام…
لمعانٍ أخرى، طالع الرملة (توضيح). الرملة تقسيم إداري البلد المغرب الجهة طنجة تطوان الحسيمة الإقليم وزان الدائرة وزان الجماعة القروية تروال المشيخة جامع الواد السكان التعداد السكاني 211 نسمة (إحصاء 2004) • عدد الأسر 35 معلومات أخرى التوقيت ت ع م±00:00 (توقيت قياسي)[1 …
NZ & Samoa international rugby league footballer Roy AsotasiPersonal informationBorn (1982-01-06) 6 January 1982 (age 41)[1]Auckland, New ZealandPlaying informationHeight181 cm (5 ft 11 in)[1]Weight108 kg (17 st 0 lb)[1]PositionProp Club Years Team Pld T G FG P 2002–06 Canterbury Bulldogs 84 8 0 0 32 2007–13 South Sydney 133 12 0 0 48 2014–15 Warrington Wolves 58 5 1 0 22 Total 275 25 1 0 102 Representative Years Team Pld T G F…
Collection of essays Kashmir: The Case for Freedom AuthorTariq Ali, Hilal Bhat, Angana P. Chatterji, Habbah Khatun, Pankaj Mishra and Arundhati RoyCountryUnited KingdomLanguageEnglishSubjectKashmir ConflictPublisherVerso BooksPublication date2011Pages140ISBN1-844-67735-4 Kashmir: The Case for Freedom is a collection of essays by Tariq Ali, Hilal Bhat, Angana P. Chatterji, Habbah Khatun, Pankaj Mishra and Arundhati Roy,[1] published by Verso.[2] Summary The first essay by Pankaj M…
Canadian ice hockey executive Michael QuinnQuinn c. 1912BornMichael James Joseph Quinn(1874-03-27)March 27, 1874Quebec City, Quebec, CanadaDiedJuly 27, 1923(1923-07-27) (aged 49)Quebec City, Quebec, CanadaOccupation(s)Ice hockey coach and general manager Michael James Joseph Quinn (March 27, 1874 – July 27, 1923) was a Canadian professional ice hockey executive. He was the manager of two Stanley Cup champion squads, the 1912 and 1913 Quebec Bulldogs.[1] He was also head coach of t…
Muse of erotic and lyric poetry in Greek mythology For other uses, see Erato (mythology), Erato Records, and Erato (disambiguation). EratoGoddess of Erotic And Lyrical PoetryMember of the MusesRoman statue of Erato (2nd century AD), playing the kithara or lyreAbodeMount OlympusSymbolsLyre, kitharaPersonal informationParentsZeus and MnemosyneSiblingsEuterpe, Polyhymnia, Urania, Clio, Calliope, Thalia, Terpsichore, MelpomeneConsortMalus(Μάλος)ChildrenCleophema Erato on an antique fresco from …
University in Sri Lanka This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages) This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.Find sources: Sabaragamuwa University of Sri Lanka – news · newspapers · books · scholar · JSTOR (Ja…
Chemring GroupTypePublic companyTraded asLSE: CHGFTSE 250 componentIndustryAerospace and DefenceFounded1905HeadquartersRomsey, UKKey peopleCarl-Peter Forster, chairman Michael Ord, CEORevenue £442.8 million (2022)[1]Operating income £64.0 million (2022)[1]Net income £47.4 million (2022)[1]Total assets £620.1 million (2022)[1]Total equity £418.1 million (2022)[1]Number of employees2,334 (2022)[1]SubsidiariesRoke Ma…
Lokasi Pengunjung: 3.17.78.254