home *** CD-ROM | disk | FTP | other *** search
/ CLIX - Fazer Clix Custa Nix / CLIX-CD.cdr / mac / lib / Mac / Files.pm < prev    next >
Text File  |  1998-04-05  |  4KB  |  241 lines

  1. =head1 NAME
  2.  
  3. Mac::Files - Macintosh Toolbox Interface to the File and Alias Manager
  4.  
  5. =head1 SYNOPSIS
  6.  
  7.  
  8. =head1 DESCRIPTION
  9.  
  10. =cut
  11.  
  12. use strict;
  13.  
  14. package Mac::Files;
  15.  
  16. BEGIN {
  17.     use Exporter   ();
  18.     use DynaLoader ();
  19.     
  20.     use vars qw(@ISA @EXPORT);
  21.     
  22.     @ISA = qw(Exporter DynaLoader);
  23.     @EXPORT = qw(
  24.         FSpGetCatInfo
  25.         FSpSetCatInfo
  26.         FSMakeFSSpec
  27.         FSpCreate
  28.         FSpDirCreate
  29.         FSpDelete
  30.         FSpGetFInfo
  31.         FSpSetFInfo
  32.         FSpSetFLock
  33.         FSpRstFLock
  34.         FSpRename
  35.         FSpCatMove
  36.         FSpExchangeFiles
  37.         NewAlias
  38.         NewAliasRelative
  39.         NewAliasMinimal
  40.         NewAliasMinimalFromFullPath
  41.         UpdateAlias
  42.         UpdateAliasRelative
  43.         ResolveAlias
  44.         ResolveAliasRelative
  45.         GetAliasInfo
  46.         UnmountVol
  47.         Eject
  48.         FlushVol
  49.         FindFolder
  50.         kOnSystemDisk
  51.         kCreateFolder
  52.         kDontCreateFolder
  53.         kSystemFolderType
  54.         kDesktopFolderType
  55.         kTrashFolderType
  56.         kWhereToEmptyTrashFolderType
  57.         kPrintMonitorDocsFolderType
  58.         kStartupFolderType
  59.         kShutdownFolderType
  60.         kAppleMenuFolderType
  61.         kControlPanelFolderType
  62.         kExtensionFolderType
  63.         kFontsFolderType
  64.         kPreferencesFolderType
  65.         kTemporaryFolderType
  66.         asiZoneName
  67.         asiServerName
  68.         asiVolumeName
  69.         asiAliasName
  70.         asiParentName
  71.     );
  72. }
  73.  
  74. bootstrap Mac::Files;
  75.  
  76.  
  77. =head2 Constants
  78.  
  79. =over 4
  80.  
  81. =item kOnSystemDisk
  82.  
  83. =item kCreateFolder
  84.  
  85. =item kDontCreateFolder
  86.  
  87. Constants for Folder Manager.
  88.  
  89. =cut
  90. sub kOnSystemDisk ()               {     0x8000; }
  91. sub kCreateFolder ()               {          1; }
  92. sub kDontCreateFolder ()           {          0; }
  93.  
  94. =item kSystemFolderType
  95.  
  96. the system folder.
  97.  
  98. =cut
  99. sub kSystemFolderType ()           {     'macs'; }
  100.  
  101. =item kDesktopFolderType
  102.  
  103. the desktop.
  104.  
  105. =cut
  106. sub kDesktopFolderType ()          {     'desk'; }
  107.  
  108. =item kTrashFolderType
  109.  
  110. the trash.
  111.  
  112. =cut
  113. sub kTrashFolderType ()            {     'trsh'; }
  114. sub kWhereToEmptyTrashFolderType () {    'empt'; }
  115. sub kPrintMonitorDocsFolderType () {     'prnt'; }
  116.  
  117. =item kStartupFolderType
  118.  
  119. the startup items folder.
  120.  
  121. =cut
  122. sub kStartupFolderType ()          {     'strt'; }
  123.  
  124. =item kShutdownFolderType
  125.  
  126. the shutdown items folder.
  127.  
  128. =cut
  129. sub kShutdownFolderType ()         {     'shdf'; }
  130.  
  131. =item kAppleMenuFolderType
  132.  
  133. the apple menu folder.
  134.  
  135. =cut
  136. sub kAppleMenuFolderType ()        {     'amnu'; }
  137.  
  138. =item kControlPanelFolderType
  139.  
  140. the control panels folder.
  141.  
  142. =cut
  143. sub kControlPanelFolderType ()     {     'ctrl'; }
  144.  
  145. =item kExtensionFolderType
  146.  
  147. the extensions folder.
  148.  
  149. =cut
  150. sub kExtensionFolderType ()        {     'extn'; }
  151.  
  152. =item kFontsFolderType
  153.  
  154. the fonts folder.
  155.  
  156. =cut
  157. sub kFontsFolderType ()            {     'font'; }
  158.  
  159. =item kPreferencesFolderType
  160.  
  161. the preferences folder.
  162.  
  163. =cut
  164. sub kPreferencesFolderType ()      {     'pref'; }
  165.  
  166. =item kTemporaryFolderType
  167.  
  168. the temporary items folder.
  169.  
  170. =cut
  171. sub kTemporaryFolderType ()        {     'temp'; }
  172.  
  173. =item asiZoneName
  174.  
  175. Return AppleTalk zone name from GetAliasInfo.
  176.  
  177. =cut
  178. sub asiZoneName ()                 {         -3; }
  179.  
  180. =item asiServerName
  181.  
  182. Return AppleTalk server name from GetAliasInfo.
  183.  
  184. =cut
  185. sub asiServerName ()               {         -2; }
  186.  
  187. =item asiVolumeName
  188.  
  189. Return volume name from GetAliasInfo.
  190.  
  191. =cut
  192. sub asiVolumeName ()               {         -1; }
  193.  
  194. =item asiAliasName
  195.  
  196. Return last component of target file name from GetAliasInfo.
  197.  
  198. =cut
  199. sub asiAliasName ()                {          0; }
  200.  
  201. =item asiParentName
  202.  
  203. Return name of enclosing folder from GetAliasInfo. This index value is 1.
  204. Higher indices will return folder names higher up the hierarchy.
  205.  
  206. =cut
  207. sub asiParentName ()               {          1; }
  208.  
  209. =back
  210.  
  211. =cut
  212. # Translate volume name or number
  213. #
  214. sub _VolumeID {
  215.     my ($id) = @_;
  216.     my ($name, $vRef);
  217.     if ($id =~ /^[^:]+:$/) {
  218.         ($name, $vRef) = ($id, 0);
  219.     } else {
  220.         ($name, $vRef) = ("", $id);
  221.     }
  222.     return ($name, $vRef);
  223. }
  224.  
  225. sub UnmountVol  {   _UnmountVol(&_VolumeID);    }
  226. sub Eject       {   _Eject     (&_VolumeID);    }
  227. sub FlushVol    {   _FlushVol  (&_VolumeID);    }
  228.  
  229. =include Files.xs
  230.  
  231. =head1 AUTHOR
  232.  
  233. Matthias Ulrich Neeracher <neeri@iis.ee.ethz.ch>
  234.  
  235. =cut
  236.  
  237. 1;
  238.  
  239. __END__
  240.