Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

MacAliasMBS.AliasInfo as AliasInfoMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin 13.1 Yes No No Yes, macOS only No
Function: Queries alias info for the alias.
Example:
dim m as new MacAliasMBS
dim f as FolderItem = SpecialFolder.Desktop

if m.Create(nil, f) = 0 then
dim info as AliasInfoMBS = m.AliasInfo

MsgBox info.TargetName + EndOfLine + info.VolumeName + EndOfLine + info.PathString
end if

Feedback, Comments & Corrections

MacAliasMBS.close
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin 3.4 Yes No No Yes, macOS only No
Function: The destructor.
Notes:
There is no need to call this method except you want to free all resources of this object now without waiting for Realbasic to do it for you.
(e.g. some Realbasic versions crash on Windows if there are plugin objects not closed.)

Feedback, Comments & Corrections

MacAliasMBS.Create(relPath as FolderItem, target as FolderItem, isDirectory as boolean = false) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Creates an AliasRecord for a given file or folder.
Example:
dim m as new MacAliasMBS

dim e as Integer = m.Create(nil, SpecialFolder.Desktop.Child("test.txt"), true)

// shows -43 as we created alias for non existing file
MsgBox str(e)
MsgBox m.AliasInfo.TargetName
Notes:
Returns zero if successful, otherwise a negative Mac OS error code.

Version 16.0 can create alias for non existing files. In that case you can tell with function isDirectory whether the target should be a directory. Still returns fnfErr (-43) if file doesn't exist but the alias will still be created.

Feedback, Comments & Corrections

MacAliasMBS.CreateAliasFromPath(targetPath as string, fromFilePath as String = "", isDirectory as boolean = false) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin 16.0 Yes No No Yes, macOS only No
Function: Creates an alias given a POSIX style utf-8 path to the target.
Example:
dim m as new MacAliasMBS

dim e as Integer = m.CreateAliasFromPath("/Users/test", "", true)

// shows -43 as we created alias for non existing file
MsgBox str(e)
MsgBox m.AliasInfo.TargetName
Notes:
Returns OS error code.

If the target file does not exist but the path up to the leaf does then fnfErr (-43) will be returned but the alias will still be created.

fromFilePath: The starting point for a relative search.
targetPath: POSIX style UTF-8 path to target.
IsDirectory: On input, if target does not exist, a flag to indicate whether or not the target is a directory.

Feedback, Comments & Corrections

MacAliasMBS.CreateFSRef(relPath as memoryblock, target as memoryblock) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Creates an AliasRecord for a given file or folder.
Notes:
The two memoryblocks are FSRefs which you can get by Folderitem.FSRef.
Returns zero if successful, otherwise a negative Mac OS error code.

Feedback, Comments & Corrections

MacAliasMBS.CreateMinimal(target as FolderItem, isDirectory as boolean = false) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Creates an AliasRecord for a given file or folder. Returns zero if successful, otherwise a negative Mac OS error code.
Notes:
Minimal creates an alias without path, so it is smaller.

Version 16.0 can create alias for non existing files. In that case you can tell with function isDirectory whether the target should be a directory. Still returns fnfErr (-43) if file doesn't exist but the alias will still be created.

Feedback, Comments & Corrections

MacAliasMBS.CreateMinimalFSRef(target as memoryblock) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Creates a minimal AliasRecord for a given file or folder.
Notes:
The memoryblock is a FSRefs which you can get by Folderitem.FSRef.
Returns zero if successful, otherwise a negative Mac OS error code.

Feedback, Comments & Corrections

MacAliasMBS.GetRecord as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Returns the AliasRecord in a String so that you can store it in a file, and pass it SetRecord for re-creating the AliasRecord (this string might contain any byte values, including zeros, so you can not display it or store it in a text file - you have to store it in a binary file or in a resource, instead!).
Notes: Attention: The length of the String is not fixed! When the Alias changes, its length usually changes, too. If you want to save this string into a binary file, you must also save its current length so that you know how much bytes to retrieve if you read it back from the file later. An easier way to store Aliases in a file is by using the Resource Manager. The sample code "FolderItems in Preferences.rbp" shows how to accomplish this.

Feedback, Comments & Corrections

MacAliasMBS.PathString as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin 13.1 Yes No No Yes, macOS only No
Function: Queries path of the alias.
Example:
dim m as new MacAliasMBS
dim f as FolderItem = SpecialFolder.Desktop

if m.Create(nil, f) = 0 then
MsgBox m.PathString
end if

Feedback, Comments & Corrections

MacAliasMBS.Resolve(relPath as FolderItem, mode as Integer) as FolderItem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Converts an AliasRecord back into a FolderItem. For values to the mode parameter see the class constants or pass in 0 for default searching (will not attempt to mount unavailable volumes).
Notes: After calling this method, the property needsUpdate tells you whether the target has been renamed or moved, which suggests that you call Update in order to reflect the change in the AliasRecord. See the demo "FolderItems in Preferences.rbp" for an example.

Feedback, Comments & Corrections

MacAliasMBS.SetRecord(record as String)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Use this method to revive an AliasRecord with the string you inquired from GetRecord earlier.

Feedback, Comments & Corrections

MacAliasMBS.TargetName as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin 13.1 Yes No No Yes, macOS only No
Function: Queries target name of the alias.
Example:
dim m as new MacAliasMBS
dim f as FolderItem = SpecialFolder.Desktop

if m.Create(nil, f) = 0 then
MsgBox m.TargetName
end if

Feedback, Comments & Corrections

MacAliasMBS.Update(relPath as FolderItem, target as FolderItem) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Updates an already created AliasRecord. Returns either a negative Mac OS error code, zero if the update didn't actually change the AliasRecord, or one if the record was changed (in this case you might want to update your record of the alias if you had stored it in a file).

Feedback, Comments & Corrections

MacAliasMBS.VolumeName as String
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Alias MBS MacClassic Plugin 13.1 Yes No No Yes, macOS only No
Function: Queries volume name of the alias.
Example:
dim m as new MacAliasMBS
dim f as FolderItem = SpecialFolder.Desktop

if m.Create(nil, f) = 0 then
MsgBox m.VolumeName
end if

Feedback, Comments & Corrections

The items on this page are in the following plugins: MBS MacClassic Plugin.




Links
MBS FileMaker blog