Platforms to show: All Mac Windows Linux Cross-Platform
MacAliasMBS class Deprecated
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Alias | MBS MacClassic Plugin | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop, Console & Web |
This Plugin implements a new Class for handling Mac OS Alias Records.
AliasRecords are like FolderItems, but can be made persistent: You can convert a FolderItem into a AliasRecord and store that AliasRecord in a file (like your Preferences file). Later you can retrieve that information again and convert it back into a FolderItem.
AliasRecords also appear inside Alias Files, that are usually created by the Finder. The enclosed sample application (Alias Mgr Plugin Demo.π) shows how to create and resolve such Alias Files.
Additional Background Information
The purpose of the class is to store paths to files and/or folders between runs of a RB application.
To store a path to a file/folder in an RB app, currently your only option is to get the abolute path as a string, and store that string in a file, usually your preferences file.
However, there is problem with using this technique: If, between runs of your app, the user changes the path of the file by moving it, or by renaming the file or any of its parent folders (including the volume name), your app will fail to locate the file next time
it is looking for it.
Fortunately, at least in Mac OS, there is a solution to this, which helps you to track your files in such a case. This is done by using Alias Records: they are the basic data structure that is also used in Alias Files as created and used in the Finder.
This class attempts to give the flexibility of Alias Records to your RB apps.
The meaning of the Relative path
When no relative path is specified, then the file is only located by its folder hierarchy down to the root of the volume. However, if a relative path is given, then the file is optionally located relative to that point.
So, if you locate files relatively to some folder, like the folder your application is in, you should specify your app's folder as the relative path so that the target is even found easily when the user moved the whole folder including your app and its related files. This is even more important when using this Alias class under Windows than under Mac OS (if files are moved in Mac OS, they often still can be found even without the help of the original folder hierarchy, while this is not possible under Windows 9x).
For Mac OS X 10.6 or newer, please also check CFBookmarkMBS module.
- property needsUpdate as boolean
- 14 methods
- method AliasInfo as AliasInfoMBS
- method close
- method Create(relPath as FolderItem, target as FolderItem, isDirectory as boolean = false) as Integer
- method CreateAliasFromPath(targetPath as string, fromFilePath as String = "", isDirectory as boolean = false) as Integer
- method CreateFSRef(relPath as memoryblock, target as memoryblock) as Integer
- method CreateMinimal(target as FolderItem, isDirectory as boolean = false) as Integer
- method CreateMinimalFSRef(target as memoryblock) as Integer
- method GetRecord as String
- method PathString as String
- method Resolve(relPath as FolderItem, mode as Integer) as FolderItem
- method SetRecord(record as String)
- method TargetName as String
- method Update(relPath as FolderItem, target as FolderItem) as Integer
- method VolumeName as String
- 12 constants
Constants
Constant | Value | Description |
---|---|---|
allVols | 8 |
One of the constants to use in Resolve.
search on multiple volumes This is the old constant name used for compatibility to older Xojo code. Use BitwiseOr or Bitwise.Or to combine this constants values. |
attemptMount | 1 |
One of the constants to use in Resolve.
mount the volume automatically This is the old constant name used for compatibility to older Xojo code. Use BitwiseOr or Bitwise.Or to combine this constants values. |
exhaustive | &h200 |
One of the constants to use in Resolve.
search further This is the old constant name used for compatibility to older Xojo code. Use BitwiseOr or Bitwise.Or to combine this constants values. |
kARMMountVol | 1 |
One of the constants to use in Resolve.
mount the volume automatically Use BitwiseOr or Bitwise.Or to combine this constants values. |
kARMMultVols | 8 |
One of the constants to use in Resolve.
search on multiple volumes Use BitwiseOr or Bitwise.Or to combine this constants values. |
kARMNoUI | 2 |
One of the constants to use in Resolve.
no user interface allowed during resolution Use BitwiseOr or Bitwise.Or to combine this constants values. |
kARMSearch | &h100 |
One of the constants to use in Resolve.
search quickly Use BitwiseOr or Bitwise.Or to combine this constants values. |
kARMSearchMore | &h200 |
One of the constants to use in Resolve.
search further Use BitwiseOr or Bitwise.Or to combine this constants values. |
kARMSearchRelFirst | &h400 |
One of the constants to use in Resolve.
search target on a relative path first Use BitwiseOr or Bitwise.Or to combine this constants values. |
kARMTryFileIDFirst | &h800 |
One of the constants to use in Resolve.
search by file id before path Use BitwiseOr or Bitwise.Or to combine this constants values. |
noDialogs | 2 |
One of the constants to use in Resolve.
no user interface allowed during resolution This is the old constant name used for compatibility to older Xojo code. Use BitwiseOr or Bitwise.Or to combine this constants values. |
relFirst | &h400 |
One of the constants to use in Resolve.
search target on a relative path first This is the old constant name used for compatibility to older Xojo code. Use BitwiseOr or Bitwise.Or to combine this constants values. |
This class has no sub classes.
Some examples using this class:
Blog Entries
- MBS Xojo Plugins, version 20.6pr3
- MBS Plugins updated for Xojo 2019r2
- MBS Xojo / Real Studio Plugins, version 16.0pr7
- MonkeyBread Software Releases the MBS Real Studio plug-ins in version 13.1
- MBS Real Studio Plugins, version 13.1pr12
Release notes
- Version 21.0
- Deprecated AliasInfoMBS and MacAliasMBS classes in favor of CFBookmarkMBS module.
The items on this page are in the following plugins: MBS MacClassic Plugin.
MAAttachedWindowMBS - MacFileOperationMBS