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.

  • 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(User.Home, gb.Write Or gb.Exec)
True
 Dim sPath As String = "/tmp"
    
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)
/tmp RW True
/tmp R  True
/tmp  W True
/tmp    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