2
This file is part of the Free Pascal run time library.
3
Copyright (c) 2004 by Olle Raab
5
Some utilities specific for Mac OS
6
Modified portions from Peter N. Lewis (PNL Libraries). Thanks !
8
See the file COPYING.FPC, included in this distribution,
9
for details about the copyright.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15
**********************************************************************}
24
function FourCharCodeToLongword(fourcharcode: Shortstring): Longword;
26
function BitIsSet(arg: Longint; bitnr: Integer): Boolean;
28
{ Converts MacOS specific error codes to the correct FPC error code.
29
All non zero MacOS errors corresponds to a nonzero FPC error.}
30
function MacOSErr2RTEerr(err: OSErr): Integer;
33
{Translates a unix or dos path to a mac path. Even a mac path can be input, }
34
{then it is returned as is. A trailing directory separator in input}
35
{will result in a trailing mac directory separator. For absolute paths, the }
36
{parameter mpw affects how the root volume is denoted. If mpw is true, }
37
{the path is intended for use in MPW, and the environment variable Boot is}
38
{prepended. Otherwise the actual boot volume name is appended.}
39
{All kinds of paths are attempted to be translated, except relative path on}
40
{a certain drive, like: C:xxx\yyy }
42
function TranslatePathToMac (const path: string; mpw: Boolean): string;
45
{Concats the relative or full path1 to the relative path2.}
46
function ConcatMacPath (path1, path2: string): string;
49
function IsMacFullPath (const path: string): Boolean;
52
function IsDirectory (var spec: FSSpec): Boolean;
54
function PathArgToFSSpec(s: string; var spec: FSSpec): Integer;
56
function PathArgToFullPath(s: string; var fullpath: AnsiString): Integer;
58
{Gives the volume name (with appended colon) for a given volume reference number.}
59
function GetVolumeName(vRefNum: Integer; var volName: String): OSErr;
61
function GetWorkingDirectoryVRefNum: Integer;
63
{Find an application with the given creator, in any of the mounted volumes.}
64
function FindApplication (creator: OSType; var fs: FSSpec): OSErr;
66
{Launch the application given by applicationFileSpec. If toFront is true
67
it will be brought to the foreground when launched.}
68
function LaunchFSSpec (tofront: Boolean; const applicationFileSpec: FSSpec): OSErr;
72
{Actually defined in system.pp. Declared here to be used in macutils.inc: }
74
{emulated working directory}
75
workingDirectorySpec: FSSpec; cvar; external;