标签:
本文转载自:https://wincent.com/wiki/@executable_path,_@load_path_and_@rpath。个人觉得写的很不错,简洁明了。
Useful for frameworks installed in shared locations. Example:
/Library/Frameworks/Foo.framework/Versions/A/Foo@executable_pathUseful for frameworks embedded inside applications, because it allows you to specify the location of the framework relative to the application‘s executable:
@executable_path/../Frameworks/Foo.framework/Versions/A/Foo/Applications/Foo.app/Applications/Foo.app/Contents/MacOS/Applications/Foo.app/Contents/Frameworks/Foo.framework/Applications/Foo.app/Contents/MacOS/../Frameworks/Foo.framework/Versions/A/FooAvailable from Mac OS X 10.4 Tiger onwards; useful for frameworks embedded inside plug-ins, because it allows you to specify the location of the framework relative to the plug-in‘s code (remember, plug-ins may not actually know where they are going to be installed, relative to the application, so knowing @executable_path doesn‘t help us in this case):
@loader_path/../Frameworks/Foo.framework/Versions/A/Foo/Applications/Foo.app/Library/Application Support/Foo/Plug-Ins/Bar.bundle/Applications/Foo.app/Contents/MacOS/Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/MacOS/Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/Frameworks/Foo.framework/Library/Application Support/Foo/Plug-Ins/Bar.bundle/Contents/MacOS/../Frameworks/Foo.framework/Versions/A/FooNote that if the "loader" is an application rather than a plug-in, the @loader_path ends up being equivalent to @executable_path.
@rpathNew in Mac OS X 10.5 Leopard is @rpath. Key points:
@rpath instructs the dynamic linker to search a list of paths in order to locate the framework@rpath/Foo.framework/Versions/A/Foo can be made to work in a number of different ways; that is, you are effectively no longer limited by the choice of specifying your "install path" using either @executable_path or @loader_path-rpath @executable_path/../Frameworks or/Library/Frameworks; note that specifying both will cause the dynamic linker to try looking in both locations)Mac OSX中的@executable_path, @load_path和@rpath的理解
标签:
原文地址:http://www.cnblogs.com/csuftzzk/p/paths_in_mac_osx.html