Platforms to show: All Mac Windows Linux Cross-Platform
Required plugins for this example: MBS MacOSX Plugin, MBS MacCF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCF/FStat List
This example is the version from Thu, 6th Apr 2016.
Project "FStat List.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
EventHandler Sub Open()
const IFMT = &o0170000 //* type of file */
const IFIFO = &o0010000 //* named pipe (fifo) */
const IFCHR = &o0020000 //* character special */
const IFDIR = &o0040000 //* directory */
const IFBLK = &o0060000 //* block special */
const IFREG = &o0100000 //* regular */
const IFLNK = &o0120000 //* symbolic link */
const IFSOCK = &o0140000 //* socket */
const IFWHT = &o0160000 //* whiteout */
const IRWXU = &o0000700 // RWX mask for owner
const IRUSR = &o0000400 // R for owner
const IWUSR = &o0000200 // W for owner
const IXUSR = &o0000100 // X for owner
const IRWXG = &o0000070 // RWX mask for group
const IRGRP = &o0000040 // R for group
const IWGRP = &o0000020 // W for group
const IXGRP = &o0000010 // X for group
const IRWXO = &o0000007 // RWX mask for other
const IROTH = &o0000004 // R for other
const IWOTH = &o0000002 // W for other
const IXOTH = &o0000001 // X for other
const ISUID = &o0004000 // set user id on execution
const ISGID = &o0002000 // set group id on execution
const ISVTX = &o0001000 // save swapped text even after use
dim stat as new DarwinChmodMBS
dim folder as FolderItem = GetFolderItem("/tmp", FolderItem.PathTypeShell)
dim c as integer=folder.Count
for i as integer=1 to c
dim file as FolderItem = folder.Trueitem(i)
if file<>nil then
if stat.stat(file.UnixpathMBS)=0 then
dim modes(-1) as string
dim rights(-1) as string
dim mode as integer = stat.mode
if BitwiseAnd(mode, IRUSR)<>0 then
rights.append "r"
else
rights.Append "-"
end if
if BitwiseAnd(mode, IWUSR)<>0 then
rights.append "w"
else
rights.Append "-"
end if
if BitwiseAnd(mode, IXUSR)<>0 then
rights.append "x"
else
rights.Append "-"
end if
if BitwiseAnd(mode, IRGRP)<>0 then
rights.append "r"
else
rights.Append "-"
end if
if BitwiseAnd(mode, IWGRP)<>0 then
rights.append "w"
else
rights.Append "-"
end if
if BitwiseAnd(mode, IXGRP)<>0 then
rights.append "x"
else
rights.Append "-"
end if
if BitwiseAnd(mode, IROTH)<>0 then
rights.append "r"
else
rights.Append "-"
end if
if BitwiseAnd(mode, IWOTH)<>0 then
rights.append "w"
else
rights.Append "-"
end if
if BitwiseAnd(mode, IXOTH)<>0 then
rights.append "x"
else
rights.Append "-"
end if
if BitwiseAnd(mode, ISUID)<>0 then
modes.append "set uid"
end if
if BitwiseAnd(mode, ISGID)<>0 then
modes.append "set gid"
end if
if BitwiseAnd(mode, ISVTX)<>0 then
modes.append "save swapped text even after use"
end if
dim format as integer = BitwiseAnd(mode, IFMT)
Select case format
case IFIFO
modes.append "named pipe (fifo)"
case IFCHR
modes.append "character special"
case IFDIR
modes.append "directory"
case IFBLK
modes.append "block special"
case IFREG
modes.append "regular"
case IFLNK
modes.append "symbolic link"
case IFSOCK
modes.append "socket"
case IFWHT
modes.append "whiteout"
end Select
List.AddRow file.DisplayName
List.Cell(List.LastIndex,1)=oct(mode)
List.Cell(List.LastIndex,3)=Join(modes,", ")
List.Cell(List.LastIndex,2)=Join(rights,"")
end if
end if
next
List.ColumnAlignment(1)=list.AlignRight
End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project
The items on this page are in the following plugins: MBS MacCF Plugin.