Share to: share facebook share twitter share wa share telegram print page

Alias (Mac OS)

Mac OS Alias
Type codealis
Uniform Type Identifier (UTI)com.apple.alias-file
Magic number'book\0\0\0\0mark\0\0\0\0'
Developed byApple, Inc.
Type of formatshortcut

In classic Mac OS System 7 and later, and in macOS, an alias is a small file that represents another object in a local, remote, or removable[1] file system and provides a dynamic link to it; the target object may be moved or renamed, and the alias will still link to it (unless the original file is recreated; such an alias is ambiguous and how it is resolved depends on the version of macOS). In Windows, a "shortcut", a file with a .lnk extension, performs a similar function.

It is similar to the Unix symbolic link, but with the distinction of working even if the target file moves to another location on the same disk (in this case it acts like a hard link, but the source and target of the link may be on different filesystems, and the target of the link may be a directory). As a descendant of BSD, macOS supports Unix symbolic (and hard) links as well.

Function

An alias acts as a stand-in for any object in the file system, such as a document, an application, a folder, a hard disk, a network share or removable medium or a printer. When double-clicked, the computer will act the same way as if the original file had been double-clicked. Likewise, choosing an alias file from within a 'File Open' dialog box would open the original file. The purpose of an alias is to assist the user in managing large numbers of files by providing alternative ways to access them without having to copy the files themselves. While a typical alias under the classic Mac OS was small, between 1 and 5 KB, under macOS it can be fairly large, more than 5 MB (5000 KB) for the alias to a folder.

Preventing alias failure

An alias is a dynamic reference to an object. The original may be moved to another place within the same filesystem, without breaking the link. The operating system stores several pieces of information about the original in the resource fork of the alias file. Examples of the information used to locate the original are:

  • path
  • file ID (inode number)
  • directory ID (inode number)
  • name
  • file size

Since any of these properties can change without the computer's knowledge, as a result of user activity, various search algorithms are used to find the most plausible target. This fault-tolerance sets the alias apart from similar functions in some other operating systems, such as the Unix symbolic link or the Microsoft Windows shortcut, at the expense of increased complexity and unpredictability. For example, an application can be moved from one directory to another within the same filesystem, but an existing alias would still launch the same application when double-clicked.

The question can arise of how an alias should work if a file is moved, and then a file is created with the same name as the original moved file, since the alias can be used to locate both the original name and the new location of the original file. With symbolic links the reference is unambiguous (soft links refer to the new file, hard links to the original). Before Mac OS X 10.2, however, such an ambiguous alias would consistently find the original moved file, rather than the recreated file. In Mac OS X 10.2 and later releases, the new file is found, matching the behaviour of symbolic links [1]. macOS applications can programmatically use the old behavior if required.

Aliases are similar in operation to shadows in the graphical Workplace Shell of the OS/2 operating system.

Distinguishing marks

In System 7 through Mac OS 9, aliases distinguished themselves visually to the user by the fact that their file names were in italics. To accommodate languages that don't have italics (such as Japanese), in Mac OS 8.5 another distinguishing mark was added, badging with an "alias arrow"—a black arrow with a small white border—similar to that used for shortcuts in Microsoft Windows.

In macOS, the filenames of aliases are not italicized, but the arrow badge remains.

File structure

The alias files in macOS start by the magic number 62 6F 6F 6B 00 00 00 00 6D 61 72 6B 00 00 00 00 which is in ASCII book␀␀␀␀mark␀␀␀␀ ( representing the Null character).

Following the magic number, it has been reported that an alias has a set of records inside it, each record is 150 bytes long and consists of the fields shown below (all integers are big endian).[2] However, alias files are far larger than this would explain, and include other information at least including icons.[3][4]

  1. 4 bytes user type name/app creator code = long ASCII text string (none = 0)
  2. 2 bytes record size = short unsigned total length
  3. 2 bytes record version = short integer version (current version = 2)
  4. 2 bytes alias kind = short integer value (file = 0; directory = 1)
  5. 1 byte volume name string length = byte unsigned length
  6. 27 bytes volume name string (if volume name string < 27 chars then pad with zeros)
  7. 4 bytes volume created mac date = long unsigned value in seconds since beginning 1904 to 2040
  8. 2 bytes volume signature = short unsigned HFS value
  9. 2 bytes volume type = short integer mac os value (types are Fixed HD = 0; Network Disk = 1; 400kB FD = 2;800kB FD = 3; 1.4MB FD = 4; Other Ejectable Media = 5 )
  10. 4 bytes parent directory id = long unsigned HFS value
  11. 1 bytes file name string length = byte unsigned length
  12. 63 bytes file name string (if file name string < 63 chars then pad with zeros)
  13. 4 bytes file number = long unsigned HFS value
  14. 4 bytes file created mac date = long unsigned value in seconds since beginning 1904 to 2040
  15. 4 bytes file type name = long ASCII text string
  16. 4 bytes file creator name = long ASCII text string
  17. 2 bytes nlvl From (directories from alias thru to root) = short integer range
  18. 2 bytes nlvl To (directories from root thru to source) = short integer range (if alias on different volume then set above to -1)
  19. 4 bytes volume attributes = long hex flags
  20. 2 bytes volume file system id = short integer HFS value
  21. 10 bytes reserved = 80-bit value set to zero
  22. 4+ bytes optional extra data strings = short integer type + short unsigned string length (types are Extended Info End = -1; Directory Name = 0; Directory IDs = 1; Absolute Path = 2; AppleShare Zone Name = 3; AppleShare Server Name = 4; AppleShare User Name = 5; Driver Name = 6; Revised AppleShare info = 9; AppleRemoteAccess dialup info = 10)
  23. string data = hex dump
  24. odd lengths have a 1 byte odd string length pad = byte value set to zero

Alias record structure outside of size length

The following is for use with the Apple's Alias Resource Manager.

  1. 4 bytes resource type name = long ASCII text string
  2. 2 bytes resource ID = short integer value
  3. 2 bytes resource end pad = short value set to zero

Java code to flag an alias file

// This function checks whether a file matches the alias magic number.
public static boolean checkForMacAliasFile(File inputFile) throws FileNotFoundException, IOException {

    // Only files can be aliases.
    // Do not test directories; they will be false.
    if (inputFile.isFile()) {
        byte[] bookmark = new byte[] {
            0x62, 0x6F, 0x6F, 0x6B, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x61, 0x72, 0x6B, 0x00, 0x00, 0x00, 0x00
        };
        long length = inputFile.length();
        if (length > 16) {
            byte[] result = new byte[16];
            FileInputStream fis = new FileInputStream(inputFile);
            fis.read(result);
            fis.close();
            return Arrays.equals(result, bookmark);
        }
    }

    return false;
}

There is a github repo with working C++ code here.

Managing aliases

User interface

In System 7, the only way to create an alias was to select the original and choose "Make Alias" from the "File" menu. An alias, with the same name and " alias" appended would then be created in the same folder. In later versions, it became possible to create aliases by drag-and-drop, while holding down the command and option modifier keys.

Mac OS 8.5 added a feature for re-connecting aliases that had been broken for one reason or another (when the simple search algorithms failed to find a reliable replacement). This was done by selecting a new target through the standard Open File dialog.

In Mac OS 8.5 options were added for command-option dragging an object in the Finder to create an alias at that location. This is where the alias cursor was added to the system. The cursor mirrors the appearance of the "create shortcut" cursor on Windows systems.

Programming API

The Alias Manager API is part of Carbon that allows developers to create aliases and access the aliased file.[5]

Mac OS X 10.6 introduced the Bookmarks API to Cocoa as a set of methods on NSURL and functions for CFURL.[6][7] In Mac OS X 10.7.3, the API was enhanced for the App Sandbox with security-scoped bookmarks, which add security permissions to aliases on a per-application or per-document basis.[8]

In Mac OS X 10.8 the Alias Manager API was officially deprecated in favor of the Bookmarks API.[5]

Unix and similar operating systems provide 2 features very similar to macOS aliases: symbolic links and hard links. When using the macOS Finder, links are displayed and treated largely like macOS aliases, and even carry an identical "Kind" attribute. However, when using the shell command line, macOS aliases are not recognized: for example, you cannot use the cd command with the name of an alias file. This is because an alias is implemented as a file on the disk that must be interpreted by an API while links are implemented within the filesystem and are thus functional at any level of the OS.

There is currently no pre-installed command to resolve an alias to the path of the file or directory it refers to. However, a freely available C program makes use of the Mac Carbon APIs to perform this task.[9] Given that, commands such as cd can be set up to check for aliases and treat them just like symbolic or hard links.

References

  1. ^ "Chapter 4 - Alias Manager / About the Alias Manager - Search Strategies". Inside Macintosh: Files. Archived from the original on October 7, 2008.
  2. ^ "Some information about MacOS aliases collected from the web". Archived from the original on 2010-01-20.
  3. ^ "Why are Finder alias files so huge lately?". Apple Support Communities. Archived from the original on 2021-05-07.
  4. ^ "Further details, including changes with various Mac OS versions". Archived from the original on 2013-04-30. Retrieved 2018-10-11.
  5. ^ a b "Alias Manager". Apple Developer Documentation. Archived from the original on 2020-08-11.
  6. ^ "NSURL and CFURL Release Notes". Mac OS X Reference Library. 2008-06-05. Archived from the original on 2018-10-26.
  7. ^ "File System Programming Guide". Mac OS X Developer Library. 2011-06-06. Archived from the original on 2011-10-06.
  8. ^ "App Sandbox in Depth". Mac OS X Developer Library. 2016-09-13. Archived from the original on 2012-07-11.
  9. ^ Davis, Thos. "getTrueName.c". Mac OS X Hints. IDG. Archived from the original on 2014-11-13. Retrieved 24 October 2016.


Read other articles:

Joe HarrisLahir(1870-01-11)11 Januari 1870Lewiston, MaineMeninggal11 Juni 1953(1953-06-11) (umur 83)Hollywood, CaliforniaPekerjaanPemeranTahun aktif1913–1923 Joe Harris (11 Januari 1870 – 11 Juni 1953) adalah seorang pemeran asal Amerika Serikat. Antara 1913 dan 1923, ia tampil dalam sekitar 94 film bisu, yang kebanyakan bergenre koboi. Ia sering beradu peran dengan bintang koboi awal Harry Carey. Sebagian filmografi The Shadow of Nazareth (1913) A Florentine Trage...

 

هذه المقالة يتيمة إذ تصل إليها مقالات أخرى قليلة جدًا. فضلًا، ساعد بإضافة وصلة إليها في مقالات متعلقة بها. (أغسطس 2019) إيلين أبريل بويلان معلومات شخصية الميلاد 10 مايو 1987 (36 سنة)[1]  أكتون (كاليفورنيا)  مواطنة الولايات المتحدة  الحياة العملية المهنة ممثلة،  وممثلة ت

 

|портрет= |Батько= |Посада= |Діти= |Мати= |Чоловік= Барановська Наталія ПетрівнаНародилася 15 липня 1948(1948-07-15) (75 років)Махачкала, Дагестанська АРСР, Російська РФСР, СРСРКраїна  СРСР УкраїнаДіяльність історикAlma mater Київський державний університетГалузь історіяЗаклад Ін�...

Ця стаття висвітлює поточну подію. Інформація може швидко змінюватися через розвиток подій, початкові відомості можуть виявитися ненадійними. Останні оновлення цієї статті можуть не відображати найсвіжішу інформацію. Російсько-українська війна Передумови та причини �...

 

63rd season of the Egyptian Premier League Football league seasonEgyptian Premier LeagueSeason2021–22Dates25 October 2021 – 30 August 2022ChampionsZamalek(14th title)RelegatedMisr Lel MakkasaEastern CompanyEl GounaChampions LeagueZamalekAl AhlyConfederation CupPyramidsFutureMatches played306Goals scored673 (2.2 per match)Top goalscorerAhmed Sayed(19 goals)Biggest home winCeramica Cleopatra 5–0 Al Ittihad(14 July 2022)Biggest away winIsmaily 0–4 Al Ahly(27 October 2021)Highest sco...

 

Overview of radio broadcasting in Australia The history of broadcasting in Australia has been shaped for over a century by the problem of communication across long distances, coupled with a strong base in a wealthy society with a deep taste for aural communications in a silent landscape.[1] Australia developed its own system, through its own engineers, manufacturers, retailers, newspapers, entertainment services, and news agencies. The government set up the first radio system, and bus...

American football player and coach (1869–1936) John HeismanHeisman at Georgia Tech circa 1918Biographical detailsBorn(1869-10-23)October 23, 1869Cleveland, Ohio, U.S.DiedOctober 3, 1936(1936-10-03) (aged 66)New York, New York, U.S.Playing careerFootball1887–1888Brown1889–1891Penn Position(s)Center, tackle, endCoaching career (HC unless noted)Football1892Oberlin1893–1894Buchtel1894Oberlin1895–1899Auburn1900–1903Clemson1904–1919Georgia Tech1920–1922Penn1923Washington & ...

 

Japanese manga series 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: Beyblade X – news · newspapers · books · scholar · JSTOR (September 2023) (Learn how and when to remove this template message) Beyblade XCover of the first volume MangaWritten byHomura KawamotoHikaru MunoIllustrated byPosuka Demi...

 

1937 filmAin't We Got FunDirected byTex AveryProduced byLeon SchlesingerStarringMel BlancBilly BletcherMusic byCarl StallingAnimation byChuck JonesBob ClampettColor processTechnicolorProductioncompanyLeon Schlesinger ProductionsDistributed byWarner Bros. PicturesRelease date May 1, 1937 (1937-05-01) Running time7 minutesLanguageEnglish Ain't We Got Fun is a 1937 Merrie Melodies cartoon directed by Tex Avery.[1] The cartoon was released on May 1, 1937.[2] The tit...

1944 battle fought between France and Germany Battle of DompairePart of World War IIPanther tank knocked out in the village of Madonne-et-Lamerey during the battleDate12–13 September 1944Locationvicinity of Dompaire, France48°13′21″N 6°13′23″E / 48.2225°N 6.2231°E / 48.2225; 6.2231Result Allied victoryBelligerents France United States  GermanyCommanders and leaders Paul de Langlade Horst von Usedom Hans von LuckStrength Groupement Langlade 60–...

 

この項目では、大長編ドラえもんの作品および1986年に公開された映画について説明しています。2011年に公開された映画については「ドラえもん 新・のび太と鉄人兵団 〜はばたけ 天使たち〜」をご覧ください。 ドラえもん > 大長編 > のび太と鉄人兵団 ドラえもん > 映画 > 大長編 > のび太と鉄人兵団 ドラえもん のび太と鉄人兵団(連載) ...

 

American actor (1929–1979) Paul WexlerWexler in Suddenly (1954)BornPaul Goodwin Wexler(1929-05-23)May 23, 1929Portland, Oregon, U.S.[1]DiedNovember 21, 1979(1979-11-21) (aged 50)Los Angeles, California, U.S.Resting placeMount Sinai Memorial Park, Los AngelesOccupationActorYears active1950–1979Spouses Susan Fox McAndie ​ ​(m. 1952; died 1958)​ Carole Minor(m. 19??; div. 19??) Marcella Wexler(m. 19??; his death 1979) Chil...

Pour les articles homonymes, voir My Hero Academia (homonymie). My Hero Academia Logo de la version française du manga. 僕のヒーローアカデミア(Boku no Hīrō Akademia) Type Shōnen Genres Nekketsu, action, école, science-fiction, fantastique, super-héros Manga Auteur Kōhei Horikoshi Éditeur (ja) Shūeisha (fr) Ki-oon Prépublication Weekly Shōnen Jump Sortie initiale 7 juillet 2014 – en cours Volumes 39 Anime japonais : Saison 1 Réalisateur Kenji Nagasaki Scénari...

 

John Newman discographyNewman performing in London, 2015Studio albums2EPs1Singles23Featured singles5 British singer John Newman has released two studio albums, 23 singles (excluding five as a featured artist) and an EP. In May 2012 John Newman featured on Rudimental's single Feel the Love. The single peaked at number one on the UK Singles Chart in early June 2012 and was also a top 5 hit in Australia, Belgium, the Netherlands and New Zealand. The song was later certified 2× Platinum by the A...

 

1993 single by Stone Temple Pilots Sex Type ThingOne of several covers used in the UKSingle by Stone Temple Pilotsfrom the album Core B-side Piece of Pie Wicked Garden (live) Sin (live) ReleasedMarch 15, 1993 (1993-03-15)GenreGrunge[1]Length3:38LabelAtlanticComposer(s) Dean DeLeo Eric Kretz Lyricist(s)Scott WeilandProducer(s)Brendan O'BrienStone Temple Pilots singles chronology Sex Type Thing (1993) Plush (1993) Audio sampleSex Type ThingfilehelpMusic videoSex Type Thin...

Museum in Jaipur, India Amrapali MuseumEntrance of the museumEstablished20 January 2018 (2018-01-20)LocationJaipur, Rajasthan, IndiaCoordinates26°54′55″N 75°48′05″E / 26.91524°N 75.80142°E / 26.91524; 75.80142TypeArt museumWebsiteamrapalimuseum.com Amrapali Museum is a museum located in Jaipur, Rajasthan, which is dedicated to Indian jewellery and decorative objects. It was inaugurated on 20 January 2018. The museum is an enterprise of the fo...

 

Motor vehicle Perodua Axia2014 Perodua Axia SEOverviewManufacturerPeroduaAlso calledDaihatsu Ayla (Indonesia)Toyota Agya/WigoProduction2014–presentAssemblyMalaysia: Serendah (PGMSB)Body and chassisClassCity car (A)Body style5-door hatchbackLayoutFront-engine, front-wheel-driveChronologyPredecessorPerodua Viva The Perodua Axia is a city car produced by Malaysian automobile manufacturer Perodua. It was launched on 15 September 2014 as the successor to the Viva.[1] The car ta...

 

Rotationsspektroskopie ist eine Weiterleitung auf diesen Artikel. Zur Schwingungs-Rotationsspektroskopie siehe Infrarotspektroskopie #Rotations-Schwingungs-Spektrum. Die Mikrowellenspektroskopie bzw. (reine) Rotationsspektroskopie ist eine zur Gruppe der Molekülspektroskopie gehörende Untersuchungsmethode, welche Informationen über Rotationen von Molekülen liefert. Daraus lassen sich Moleküle identifizieren und weitere grundlegende Eigenschaften, wie z. B. die Bindungsstärke, gewin...

For other ships with the same name, see Leander (ship). Leander History United Kingdom OwnerJoseph Somes, Merchant Shipping Co, London BuilderJ G Lawrie of Glasgow Launched1867 AcquiredR. Anderson of London, Ross & Company Oman OwnerSeyed Youssouf bin Ahmed Zuwawee Acquired1895 RenamedNusrool Mujeed FateBroken up in 1901 General characteristics Tonnage 886 GRT 848 NRT[1] Length215.5 ft (65.7 m)[1] Beam35.2 ft (10.7 m)[1] Depth20.7 ...

 

Lesley Turner Nazionalità  Australia Tennis Termine carriera 1977 Hall of fame  (1997) Carriera Singolare1 Vittorie/sconfitte Titoli vinti Miglior ranking 2 (1964) Risultati nei tornei del Grande Slam  Australian Open F (1964, 1967)  Roland Garros V (1963, 1965)  Wimbledon SF (1964)  US Open SF (1967) Doppio1 Vittorie/sconfitte Titoli vinti Miglior ranking Risultati nei tornei del Grande Slam  Australian Open V (1964, 1965, 1967)  Roland Garros V (1964...

 
Kembali kehalaman sebelumnya