AcediaDocumentation

FileDialogItem

File and folder handles returned by workspace pickers.

Wrapper returned by openfiledialog, openfilesdialog, openfolderdialog, and savefiledialog. The wrapper captures its workspace-relative path at creation time; file-only methods are attached on items that pointed to a file at creation, and folder-only methods on items that pointed to a folder.

Shared members

MemberType / signatureMeaning
PathstringWorkspace-relative path captured by the item.
GetNameGetName(): stringReturns the last path component.
IsFileIsFile(): booleanRechecks whether the captured path currently refers to a file.
IsFolderIsFolder(): booleanRechecks whether the captured path currently refers to a folder.
DeleteDelete(): ()Deletes the captured path; folders are removed recursively.

File methods

Present when the item was created from a file path.

MemberType / signatureMeaning
ReadRead(): stringReads the file's full contents.
WriteWrite(contents: string): ()Overwrites the file with contents.
AppendAppend(contents: string): ()Appends contents to the end of the file.

Folder methods

Present when the item was created from a folder path.

MemberType / signatureMeaning
ListList(recursive: boolean?): {FileDialogItem}Lists immediate children; set recursive = true to descend through subfolders.
MakeFolderMakeFolder(name: string): FileDialogItemCreates a child directory and returns its wrapper.

Notes

  • Changing the exposed Path field does not change the captured path used by the item's methods — reassigning Path is cosmetic.
  • The path type (file vs. folder) is resolved once at creation. Recheck with IsFile / IsFolder if another script can move or replace the path.

Example

local selected = openfiledialog({ extensionFilter = { "txt" } })
if selected and selected:IsFile() then
    print(selected:GetName(), #selected:Read())
end

On this page