Skip to content

FileSystemItem class

The base interface for everything inside the IDE's virtual file system. Both File and Folder extend FileSystemItem and inherit its four universal members (Name, Path, Type, Parent). An item returned from a Folder enumeration or from FileSystem.ResolvePath is normally castable to its specific kind --- the Type property or TypeOf discriminates between them.

vb
Dim item As FileSystemItem
For Each item In Host.CurrentProject.RootFolder
    If TypeOf item Is Folder Then
        ' …recurse
    Else
        Dim file As File = item
        ' …read
    End If
Next

Properties

Name

The item's name (the last segment of its Path). String, read-only. For files, includes the extension.

Parent

The folder that contains this item. As Folder. Read-only. The root folder's Parent is Nothing.

Path

The item's full virtual-FS path --- e.g. "twinbasic:/Sources/MainModule.twin". String, read-only. Suitable as the Path argument to Editors.Open and FileSystem.ResolvePath.

Type

The kind of item. As FileSystemItemType (see below). Read-only. For folders the value is always Folder; for files it identifies the file's encoding and role.

FileSystemItemType

A type discriminator returned by Type.

ConstantValueDescription
Folder0A folder.
FileVIRTUALDOC1A read-only virtual document --- the placeholder content the IDE renders for unrecognised file types. Unicode (UTF-16).
FileOTHER2A file the IDE recognises as binary or whose encoding it cannot determine. File.ReadText is not supported on this kind.
FileTWIN3A twinBASIC source file (.twin). UTF-8 encoded on disk.
FileBAS4A VB6-compatible standard module file (.bas). System ANSI encoded on disk.
FileCLS5A VB6-compatible class module file (.cls). System ANSI encoded on disk.
FileUIDESIGNER6A UI-designer surface for a Form, expressed as JSON. UTF-8 encoded.
FileJSON7A JSON file --- typically the project's Settings or other JSON project data. UTF-8 encoded.

twinBASIC and LOGO copyright of "WaynePhillipsEA" author