Skip to content

Modern Fs GetWin32Attributes

Paul Squires edited this page Nov 9, 2026 · 6 revisions

Home › Filesystem › Filesystem Library › GetWin32Attributes

GetWin32Attributes

Returns a file's raw Windows attribute flags; fails as unsupported on Linux and macOS.

Syntax

GetWin32Attributes( p )

Examples

#import "std/fs"
using fs

dim td as FsResultUStr = CreateTempDir( "fbdoc" )
dim as ustring dir_ = td.Value( )
dim as ustring p = PathJoin( dir_, "f.txt" )
WriteAllText( p, "hello" )

'' The raw dwFileAttributes word. WINDOWS ONLY -- elsewhere it fails
'' rather than inventing a value.
dim r as FsResultULong = GetWin32Attributes( p )

print r.IsOk( )              '' true on Windows
if r.IsOk( ) then print r.Value( ) > 0    '' -1 (true)

'' Code that reads this is platform code by definition. IsReadOnly and
'' IsHidden are the portable questions.

RemoveDirAll( dir_ )

Library: Filesystem Library
Category: Filesystem
Documented under: Links And Permissions

Clone this wiki locally