/ lang / access
Access
Syntax

    Accessible = Access ( Path AS String [ , Mode AS Integer ] ) AS Boolean

Returns TRUE if the file specified by Path is accessible by the mode specified by Mode .

If the value of Mode is:

- gb.Read, then returns TRUE if the file can be read.
- gb.Write, then returns TRUE if the file can be written.
- gb.Exec, then returns TRUE if the file can be executed.

The previous flags can be combined with the OR operator.

- gb.Read, is the default behavior when the optional argument Mode is not specified.

For a directory, the execution flag means that the directory may be browsed.

### Examples

    PRINT Access("/home/benoit", gb.Write OR gb.Exec)
    <hr>True

    PUBLIC SUB Button1_Click()
    DIM sPath AS String

    sPath = "/root/bin"
    PRINT sPath; " RW "; Access(sPath, gb.Read OR gb.write)
    PRINT sPath; " R  "; Access(sPath, gb.Read)
    PRINT sPath; "  W "; Access(sPath, gb.write)
    PRINT sPath; "    "; Access(sPath)

    END
    <hr>/root/bin RW False
    /root/bin R  True
    /root/bin  W False
    /root/bin    True

| All files under the project directory (including any subdirectories created under the project directory are treated as read-only despite any actual mode settings, even files set to permission mode 777 (full access read-and-write for owner, group and world), (ie: Access("img/myImage.png") will never return gb.Write). Use tempfiles or create a special directory (dotfile) in the active user (ie: user running the Gambas program) home directory.
    PRINT Access("data/img/myImage.png", gb.Write)
    <hr>False ' Even after performing: <b>chmod 777 "PathToMyProject/img/myImage.png"</b>

### See also

File & Directory Functions