Xojo Conferences
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

Previous items Next items

Folderitem.FSRefNameMBS(byref name as string) as memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 3.2 Yes No No Yes, macOS only No
Function: Returns the FSRef to this folderitem as a memoryblock.
Notes:
Only useful for toolbox calls.
Requires Mac OS X or Mac OS 9.
If the folderitem's file doesn't exist, you get the parent folder's FSRef.
The name will be filled with the name of the item.

Feedback, Comments & Corrections

Folderitem.GetFileAttributeMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin No No No Yes No
Function: Get the file attributes for the folderitem to the given value. Returns a negative if there is an error.
Notes:
Returns the flAttrib of a file. If you pass in a non-existing file or a folder, a negative error code is returned instead.
The flAttrib is a set of bits with the following meaning:
bit 0,value 1file is locked
bit 2,value 4resource fork is open
bit 3,value 8data fork is open
bit 4,value 16item is a directory
bit 7,value 128file (one or both forks) is open
(See GetFileFlags for an example on how to check the bits)

On Mac OS X the information whether a file is open is not available.

Feedback, Comments & Corrections

Folderitem.GetFileFlagsMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Get the file flags for a folderitem.
Example:
// For example, testing for a file being invible works like this:
dim fdFlags as Integer
dim fileIsInvisible as boolean
dim f as FolderItem // file

fdFlags = f.GetFileFlagsMBS
if fdFlags < 0 then
' ... oops, an error occured
else
fileIsInvisible = BitwiseAnd (fdFlags, &H4000) <> 0
end
Notes:
Returns the fdFlags of a file. If you pass in a non-existing file or a folder, a negative error code is returned instead.

The fdFlags is a set of bits with the following meaning:
bit 15value &H8000isAlias
bit 14value &H4000isInvisible
bit 13value &H2000hasBundle (has a BNDL resource)
bit 12value &H1000nameLocked
bit 11value &H0800isStationary
bit 10value &H0400hasCustomIcon
bit 8value &H0100hasBeenInited (Finder has seen the file since it has been created)
bit 7value &H0080hasNoINITs (there is no INIT rsrc in the Extension file)
bit 6value &H0040isShared
bits 1-3value &H000Ecolor (as a 3-bit value from 0-7)

Some examples which use this method:

Feedback, Comments & Corrections

Folderitem.GetFolderFlagsMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Get the folder flags for the folderitem to the given value. Returns a negative if there is an error.
Notes:
Returns the frFlags of a folder. If you pass in a non-existing folder, a negative error code is returned instead.
The frFlags are similar to the fdFlags (see GetFileFlags), but only a subset of them is used with folders.

Some examples which use this method:

Feedback, Comments & Corrections

FolderItem.GetVolumeRefMBS as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 16.4 Yes No No Yes, macOS only No
Function: Returns the volume reference number.
Notes: Returns zero in case of error.

Feedback, Comments & Corrections

Folderitem.IsCompressedFileMBS as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin No Yes No Yes, Windows only No
Function: Is this file a compressed one?
Notes: On Windows you can compress individual files to double your harddisk, but no application may note, because this compression is transparent.

Feedback, Comments & Corrections

Folderitem.IsEjectableVolumeMBS as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 2.7 Yes No No Yes, macOS only No
Function: Returns true if the file is on a ejectable volume.
Example:
dim bool as Boolean
dim f as FolderItem = volume(0)

bool=f.IsEjectableVolumeMBS
Notes:
If false is returned it may also be possible that the function is not available (on Mac OS X 10.2) or doesn't make sense. So the volume may be ejectable even if false is returned.

For remote volumes, the eject flag is not set from Apple. That makes sense as those volume are not physically ejected, but just unmounted. So check IsOnRemoteVolumeMBS, too.

Feedback, Comments & Corrections

Folderitem.IsEncryptedFileMBS as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin No Yes No Yes, Windows only No
Function: Is this file an encrypted one?
Notes: On Windows you can encrypted individual files to secure your harddisk, but no application may note, because this encryption is transparent to them.

Feedback, Comments & Corrections

Folderitem.IsFileDataForkOpenReadWriteMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 4.1 Yes Yes Yes Yes No
Function: Test whether a file is currently opened for read and write by an application.
Notes: This method tries to open the file with exclusive access. If this fails for access/permission errors, the function returns true.

Feedback, Comments & Corrections

Folderitem.IsFileResourceForkOpenReadWriteMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 4.1 Yes Yes Yes Yes No
Function: Test whether a file is currently opened for read and write by an application.
Notes:
This method tries to open the file with exclusive access. If this fails for access/permission errors, the function returns true.
On Windows, the function result is always false.

Feedback, Comments & Corrections

Folderitem.IsOnRemoteVolumeMBS as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin Yes No No Yes, macOS only No
Function: Returns true if the file is on a remote volume.

Some examples which use this method:

Feedback, Comments & Corrections

FolderItem.ItemsMBS as Folderitem()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 12.0 Yes Yes Yes Yes No
Function: Returns array of items in the given folder.
Example:
dim folder as FolderItem = SpecialFolder.Desktop
dim Items() as FolderItem = folder.ItemsMBS
MsgBox str(UBound(Items)+1)+" items"
Notes: Similar to item() function, but returns all items with one call.

Feedback, Comments & Corrections

Folderitem.KindMBS as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin Yes Yes No Yes No
Function: Returns a string about the kind of the document.
Example:
dim s as string
dim file as FolderItem = SpecialFolder.Desktop

s=file.KindMBS

MsgBox s
Notes:
e.g. for a Realbasic document on Mac OS X "REALbasic Document" or on Mac OS 9 something like "REALbasic 4.0.2fc6 Mac OS X Document".

This text may be localized.
Added Windows support in 12.4 plugins.

Some examples which use this method:

Feedback, Comments & Corrections

Folderitem.LaunchMBS(inFront as Boolean) as Boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin Yes Yes No Yes No
Function: Launches a file.
Notes:
In Realbasic 4.5 Realsoftware introduces a new Launch variant: "Launch(inFront)". To be compatible I renamed the old Launch method to MBSLaunch and added a Launch method which is compatible to Realbasic's.

The return value is true if no immediate error occured. It would be false, for instance, if the FolderItem object does not exists, is a folder, or is not allowed to be opened (can happen with files on network volumes, as well as in Mac OS X environments).
Added Windows support in version 3.4.

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.LogicalFileDataLengthMBS as int64
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 7.4 Yes Yes Yes Yes No
Function: Returns the length of the logical disk space used for this file's data fork.
Example:
dim f as FolderItem = SpecialFolder.Desktop.Child("test.jpg")

dim lines(-1) as string

lines.Append "Length: "+str(F.Length)
lines.Append "ResourceForkLength: "+str(F.ResourceForkLength)
lines.Append "LogicalFileDataLengthMBS: "+str(F.LogicalFileDataLengthMBS)
lines.Append "LogicalFileResLengthMBS: "+str(F.LogicalFileResLengthMBS)
lines.Append "LogicalFileTotalLengthMBS: "+str(F.LogicalFileTotalLengthMBS)
lines.Append "PhysicalFileDataLengthMBS: "+str(F.PhysicalFileDataLengthMBS)
lines.Append "PhysicalFileResLengthMBS: "+str(F.PhysicalFileResLengthMBS)
lines.Append "PhysicalFileTotalLengthMBS: "+str(F.PhysicalFileTotalLengthMBS)

MsgBox Join(lines,EndOfLine)
Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.LogicalFileResLengthMBS as int64
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 7.4 Yes Yes Yes Yes No
Function: Returns the length of the logical disk space used for this file's resourcefork.
Example:
filesize.text=format(file.LogicalFileResLengthMBS,"0")
Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.LogicalFileTotalLengthMBS as int64
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 7.4 Yes Yes Yes Yes No
Function: Returns the length of the logical disk space used for this file's datafork.
Example:
filesize.text=format(file.LogicalFileTotalLengthMBS,"0")
Notes:
This function works for files bigger than 2 GB which RB's built in functions don't.
On Windows the physical size reported is equal to the logical size, because there is no function for the physical size.

Some examples which use this method:

Feedback, Comments & Corrections

Folderitem.LongPathMBS as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Win Plugin No Yes No No No
Function: Returns the long path for the file.
Example:
dim f as folderitem = specialfolder.desktop.child("test.file")
msgbox f.longpathMBS
Notes:
Should be the same as f.absolutepath
Works with Windows NT 4 or newer.

Some examples which use this method:

Feedback, Comments & Corrections

Folderitem.MacCopyObjectMBS(DestinationFolder as folderitem, DestinationName as string, byref Result as folderitem, Options as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 9.2 Yes No No Yes, macOS only No
Function: This routine will copy the source object into the destination directory.
Notes:
The source object can be a file or directory.

self: The source object to copy.
DestinationFolder: The destination directory for the copy.
DestinationName: The name for the new object in the destination directory. Pass "" to use the source object name.
result: Upon successful completion a ref to the newly created object. If source is a directory then target will be the corresponding object in the destination directory.
options: One or more FSFileOperation flags

Requires Mac OS X 10.4.

Use this constants:
kFSFileOperationDefaultOptions0Use the default options - no overwrite, fail if any source item cannot be read, cross volume moves OK.
kFSFileOperationOverwrite1Replace an item in the destDir that has the same name as an item being moved/copied there.
kFSFileOperationSkipSourcePermissionErrors2Skip items that cannot be read and continue copying/moving instead of failing the operation.
kFSFileOperationDoNotMoveAcrossVolumes4Do not perform a copy/delete to move an item across volume boundries - fail the operation instead.
kFSFileOperationSkipPreflight8Skip the preflight for a directory move/copy. This will limit the status information that can be returned since the totals will not be calculated.

Returns a Mac OS error code. Error code -1 is from the plugin for invalid parameters or the function not being availanle.

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.MacIsHardLinkedMBS as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 9.1 Yes No No Yes, macOS only No
Function: Whether the file is a hard link.
Notes:
If two directory entries point to the same hard disc space, you have a file which has two directory entries, but only one storage.

This function returns true for files in a Time Machine backup which did not change since the last backup and share their disc space with the other backups.

Feedback, Comments & Corrections

Folderitem.MacMoveObjectMBS(DestinationFolder as folderitem, DestinationName as string, byref Result as folderitem, Options as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 9.2 Yes No No Yes, macOS only No
Function: This routine will move the source object into the destination directory.
Notes:
The source object can be a file or directory. If a destName is provided then the object will be renamed as well as moved. By default a move across volumes will result in a copy and deletion of the original source. The kFSFileOperationDoNotMoveAcrossVolumes flag will cause cross volume moves to do nothing and return an error.

self: The source object to copy.
DestinationFolder: The destination directory for the copy.
DestinationName: The name for the new object in the destination directory. Pass "" to use the source object name.
result: Upon successful completion a ref to the newly created object. If source is a directory then target will be the corresponding object in the destination directory.
options: One or more FSFileOperation flags

Requires Mac OS X 10.4.

Use this constants:
kFSFileOperationDefaultOptions0Use the default options - no overwrite, fail if any source item cannot be read, cross volume moves OK.
kFSFileOperationOverwrite1Replace an item in the destDir that has the same name as an item being moved/copied there.
kFSFileOperationSkipSourcePermissionErrors2Skip items that cannot be read and continue copying/moving instead of failing the operation.
kFSFileOperationDoNotMoveAcrossVolumes4Do not perform a copy/delete to move an item across volume boundries - fail the operation instead.
kFSFileOperationSkipPreflight8Skip the preflight for a directory move/copy. This will limit the status information that can be returned since the totals will not be calculated.

Returns a Mac OS error code. Error code -1 is from the plugin for invalid parameters or the function not being availanle.

Some examples which use this method:

Feedback, Comments & Corrections

Folderitem.MacMoveObjectToTrashMBS(byref Result as folderitem, Options as Integer) as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 9.2 Yes No No Yes, macOS only No
Function: This routine will move the source object into the trash.
Notes:
The source object can be a file or directory. If the volume the source object resides on does not support a trash folder then this call will return an error (this is the same circumstance that triggers the delete immediately behavior in the Finder).

self: The source object to move to the trash.
result: Upon successful completion a ref the object in the trash. If source is a directory then target will be the corresponding object in the destination directory.
options: One or more FSFileOperation flags

Requires Mac OS X 10.5.

Use this constants:
kFSFileOperationDefaultOptions0Use the default options - no overwrite, fail if any source item cannot be read, cross volume moves OK.
kFSFileOperationOverwrite1Replace an item in the destDir that has the same name as an item being moved/copied there.
kFSFileOperationSkipSourcePermissionErrors2Skip items that cannot be read and continue copying/moving instead of failing the operation.
kFSFileOperationDoNotMoveAcrossVolumes4Do not perform a copy/delete to move an item across volume boundries - fail the operation instead.
kFSFileOperationSkipPreflight8Skip the preflight for a directory move/copy. This will limit the status information that can be returned since the totals will not be calculated.

Returns a Mac OS error code. Error code -1 is from the plugin for invalid parameters or the function not being availanle.

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.MacNodeIDMBS as UInt64
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 9.1 Yes No No Yes, macOS only No
Function: The node ID for this file or folder.
Example:
// get some file
dim f as FolderItem = GetTrueFolderItem("/Users/cs/Desktop/test.rtf", folderitem.PathTypeNative)

// get
dim NodeId as UInt64 = f.MacNodeIDMBS
dim ParentId as UInt64 = f.MacParentDirectoryIDMBS
dim p as FolderItem = volume(0).MacResolveNodeIDMBS(NodeId)

MsgBox "Node ID: "+str(NodeId)+EndOfLine+_
"Parent ID: "+str(ParentId)+EndOfLine+_
"Path resolved: "+p.NativePath
Notes: Upgraded in plugin version 18.4 to use newer APIs for 64-bit IDs on AFS volumes.

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.MacParentDirectoryIDMBS as UInt64
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 9.1 Yes No No Yes, macOS only No
Function: The parent directory node ID for this file or folder.
Notes: Upgraded in plugin version 18.4 to use newer APIs for 64-bit IDs on AFS volumes.

Some examples which use this method:

Feedback, Comments & Corrections

Folderitem.MacQuarantinePropertiesMBS as MacQuarantinePropertiesMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Files MBS MacFrameworks Plugin 9.8 Yes No No Yes, macOS only No
Function: Gets or sets the quarantine options for a file.
Example:
dim f as FolderItem = SpecialFolder.Desktop.Child("test.app")

// read value
dim q as MacQuarantinePropertiesMBS = f.MacQuarantinePropertiesMBS
MsgBox q.AgentName

// set value
q = new MacQuarantinePropertiesMBS

q.AgentBundleIdentifier = "test.test"
q.AgentName = "testing app"
q.DataURL="http://www.monkeybreadsoftware.de/test.dmg"
q.OriginURL="http://www.monkeybreadsoftware.de/"
q.Type=q.kTypeWebDownload

f.MacQuarantinePropertiesMBS = q

// clear
f.MacQuarantinePropertiesMBS = nil
Notes:
Requires Mac OS X 10.5.
(Read and Write computed property)

Some examples which use this property:

Feedback, Comments & Corrections

folderitem.MacResolveNodeIDMBS(NodeID as UInt64) as folderitem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS MacClassic Plugin 13.0 Yes No No Yes, macOS only No
Function: Resolves a NodeID by searching for a folderitem on the volume with given NodeID.
Example:
// get a volume
dim f as FolderItem = volume(0)

// test with desktop
dim d as FolderItem= SpecialFolder.Desktop

// query node
dim NodeID as UInt32 = d.MacNodeIDMBS

// and search back
dim dest as FolderItem = f.MacResolveNodeIDMBS(nodeid)

MsgBox dest.AbsolutePath
Notes:
NodeIDs may not be supported on all volumes.
Returns nil on any error.
Upgraded in plugin version 18.4 to use newer APIs for 64-bit IDs on AFS volumes.

Feedback, Comments & Corrections

folderitem.ModificationDateMBS(UTC as boolean = false) as date
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Files MBS Util Plugin 10.1 Yes Yes Yes Yes No
Function: The modification date of the file or folder.
Example:
dim f as FolderItem = SpecialFolder.Desktop.Child("test.txt")
dim xd as date = f.ModificationDateMBS
MsgBox xd.LongDate+" "+xd.LongTime
Notes:
Setting this value is not supported on Linux currently.
If UTC is true, you get/set date object where time is UTC.
(Read and Write computed property)

Some examples which use this property:

Feedback, Comments & Corrections

folderitem.NameExtensionMBS as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 10.3 Yes Yes Yes Yes No
Function: The file extension from the file name.
Example:
dim f as folderitem = SpecialFolder.desktop

MsgBox "Name: "+f.Name+EndOfLine+"Name extension: "+f.NameExtensionMBS+EndOfLine+"Name without extension: "+f.NameWithoutExtensionMBS

dim g as FolderItem = SpecialFolder.Desktop.Child("test.rbp")

MsgBox "Name: "+g.Name+EndOfLine+"Name extension: "+g.NameExtensionMBS+EndOfLine+"Name without extension: "+g.NameWithoutExtensionMBS
Notes:
If there is no extension, this string is empty.
The extension does not include the dot.

Some examples which use this method:

Feedback, Comments & Corrections

folderitem.NameWithoutExtensionMBS as string
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Files MBS Util Plugin 10.3 Yes Yes Yes Yes No
Function: The file name without file extension.
Example:
dim f as folderitem = SpecialFolder.desktop

MsgBox "Name: "+f.Name+EndOfLine+"Name extension: "+f.NameExtensionMBS+EndOfLine+"Name without extension: "+f.NameWithoutExtensionMBS

dim g as FolderItem = SpecialFolder.Desktop.Child("test.rbp")

MsgBox "Name: "+g.Name+EndOfLine+"Name extension: "+g.NameExtensionMBS+EndOfLine+"Name without extension: "+g.NameWithoutExtensionMBS
Notes: If there is no extension, the whole name is returned.

Some examples which use this method:

Feedback, Comments & Corrections

NewFolderItemFSRefMBS(fsref as memoryblock) as FolderItem
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
global method Files MBS Util Plugin Yes No No Yes, macOS only No
Function: Creates a FolderItem from a specified FSRef.
Example:
dim f,g as folderItem
dim m as memoryBlock

f=getfolderItem("")

m=f.FSRefMBS

g=NewFolderItemFSRefMBS(m)
msgBox g.absolutePath // same path as f
Notes: Only useful for toolbox calls and on Mac OS 9 and later.

Feedback, Comments & Corrections

Previous items Next items

The items on this page are in the following plugins: MBS MacClassic Plugin, MBS MacFrameworks Plugin, MBS Util Plugin, MBS Win Plugin.




Links
MBS FileMaker blog