NAME
Mac::SystemDirectory - Locate Mac OS X Standard System Directories
VERSION
version 0.14
SYNOPSIS
use Mac::SystemDirectory qw[:all];
$path = FindDirectory(NSDocumentDirectory);
$path = HomeDirectory();
$path = TemporaryDirectory();
DESCRIPTION
Locate Mac OS X Standard System Directories
FUNCTIONS
- FindDirectory(Directory [, DomainMask])
-
Creates a list of path strings for the specified directories in the specified domains. The list is in the order in which you should search the directories.
Usage
$path = FindDirectory(NSApplicationDirectory); @paths = FindDirectory(NSApplicationDirectory);Arguments
- Directory
-
"Directory" constant.
- DomainMask (optional)
-
"DomainMask" constant. Defaults to
NSUserDomainMask.
Returns
When called in scalar context this function returns the first matching directory. In list context it returns all matching directories. If no directories are found, undef is returned in a scalar context and an empty list in a list context.
- HomeDirectory()
-
Path to the current user's home directory.
Usage
$path = HomeDirectory();Returns
A string containing the path of the current user's home directory.
- TemporaryDirectory()
-
Path to the current user's temporary directory.
Usage
$path = TemporaryDirectory();Returns
A string containing the path of the temporary directory for the current user. If no such directory is currently available, returns undef.
CONSTANTS
DomainMask
Bitmask constants that identify the file-system domain (User, System, Local, Network) or all domains.
- NSUserDomainMask
-
The user's home directory-the place to install user's personal items (~).
Available in Mac OS X v10.0 and later.
- NSLocalDomainMask
-
Local to the current machine-the place to install items available to everyone on this machine.
Available in Mac OS X v10.0 and later.
- NSNetworkDomainMask
-
Publicly available location in the local area network-the place to install items available on the network (/Network).
Available in Mac OS X v10.0 and later.
- NSSystemDomainMask
-
Provided by Apple - can't be modified (/System).
Available in Mac OS X v10.0 and later.
- NSAllDomainsMask
-
All domains. Includes all of the above and future items.
Available in Mac OS X v10.0 and later.
Directory
Constants that identify the name or type of directory (for example, Library, Documents, or Applications).
- NSApplicationDirectory
-
Supported applications (/Applications).
Available in Mac OS X v10.0 and later.
- NSDemoApplicationDirectory
-
Unsupported applications and demonstration versions.
Available in Mac OS X v10.0 and later.
- NSDeveloperApplicationDirectory
-
Developer applications (/Developer/Applications).
Available in Mac OS X v10.0 and later.
- NSAdminApplicationDirectory
-
System and network administration applications.
Available in Mac OS X v10.0 and later.
- NSLibraryDirectory
-
Various user-visible documentation, support, and configuration files (/Library).
Available in Mac OS X v10.0 and later.
- NSDeveloperDirectory
-
Developer resources (/Developer). Deprecated: Beginning with Xcode 3.0, developer tools can be installed in any location.
Available in Mac OS X v10.0 and later.
- NSUserDirectory
-
User home directories (/Users).
Available in Mac OS X v10.0 and later.
- NSDocumentationDirectory
-
Documentation.
Available in Mac OS X v10.0 and later.
- NSDocumentDirectory
-
Document directory.
Available in Mac OS X v10.2 and later.
- NSCoreServiceDirectory
-
Location of core services (System/Library/CoreServices).
Available in Mac OS X v10.4 and later.
- NSAutosavedInformationDirectory
-
Location of user's autosaved documents Documents/Autosaved
Available in Mac OS X v10.6 and later.
- NSDesktopDirectory
-
Location of user's desktop directory.
Available in Mac OS X v10.4 and later.
- NSCachesDirectory
-
Location of discardable cache files (Library/Caches).
Available in Mac OS X v10.4 and later.
- NSApplicationSupportDirectory
-
Location of application support files (Library/Application Support).
Available in Mac OS X v10.4 and later.
- NSDownloadsDirectory
-
Location of the user's downloads directory.
Available in Mac OS X v10.5 and later.
- NSInputMethodsDirectory
-
Location of Input Methods (Library/Input Methods)
Available in Mac OS X v10.6 and later.
- NSMoviesDirectory
-
Location of user's Movies directory (~/Movies)
Available in Mac OS X v10.6 and later.
- NSMusicDirectory
-
Location of user's Movies directory (~/Music)
Available in Mac OS X v10.6 and later.
- NSPicturesDirectory
-
Location of user's Movies directory (~/Pictures)
Available in Mac OS X v10.6 and later.
- NSPrinterDescriptionDirectory
-
Location of system's PPDs directory (Library/Printers/PPDs)
Available in Mac OS X v10.6 and later.
-
Location of user's Public sharing directory (~/Public)
Available in Mac OS X v10.6 and later.
- NSPreferencePanesDirectory
-
Location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes)
Available in Mac OS X v10.6 and later.
- NSItemReplacementDirectory
-
For use with NSFileManager method URLForDirectory:inDomain:appropriateForURL:create:error:
Available in Mac OS X v10.6 and later.
- NSAllApplicationsDirectory
-
All directories where applications can occur.
Available in Mac OS X v10.0 and later.
- NSAllLibrariesDirectory
-
All directories where resources can occur.
Available in Mac OS X v10.0 and later.
EXPORT
None by default. Functions and constants can either be imported individually or in sets grouped by tag names. The tag names are:
:allexports all functions and constants.:DomainMaskexports all "DomainMask" constants.:Directoryexports all "Directory" constants.
SEE ALSO
http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/LowLevelFileMgmt/Articles/StandardDirectories.html http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPFileSystem/BPFileSystem.html
SUPPORT
Bugs may be submitted through the RT bug tracker (or bug-Mac-SystemDirectory@rt.cpan.org).
AUTHOR
Christian Hansen <chansen@cpan.org>
CONTRIBUTOR
Karen Etheridge <ether@cpan.org>
COPYRIGHT AND LICENCE
This software is copyright (c) 2009 by Christian Hansen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.