lang • access

Access

Accessible = Access ( Path [ , Mode ] )

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

If the value of Mode is:

The previous flags can be combined with the OR operator.

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

Examples

Print Access("/home/benoit", gb.Write Or gb.Exec)
True
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)
/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).

Here is the reason: when making the executable, all project files are put inside the executable file, and so cannot be modified at runtime.

Use temporary files or create a special directory (dotfile) in the current user home directory.

Print Access("data/img/myImage.png", gb.Write)
False ' Even after performing: chmod 777 "PathToMyProject/img/myImage.png"

See also