Skip to content
Get Free Trial

Restrict Files Access

This section describes how we can restrict Sahi Pro's access to different files. It is available since Sahi Pro V6.3.1.

By default, Sahi Pro’s file manipulation functions like _readFile,_writeFile,_deleteFile,_renameFile,_copyFileetc. have access to all the files on the file system. This can be restricted to only specific directories by configuring the property file.accessible.dir in <sahi_root>/userdata/config/userdata_hidden.properties file.

See the examples below :

// Use wildcard '*' to provide access to all the files.
file.accessible.dir=*; // By default, Sahi Pro has access to all the files.
// Restrict Sahi Pro's access to only the files inside example directory and its sub-directories.
file.accessible.dir=D:/testing/example; // Must use '\\' or '/' as file path separator.
// Restrict SahiPro's access to only the files inside Sahi Pro's default scripts directory and its sub-directories.
file.accessible.dir=userdata/scripts; // The path here is relative to Sahi Pro installation directory
// Provide access to multiple directories by separating multiple directories with semi-colon.
// Restrict Sahi Pro's access to only the files inside 'scripts directory and its sub-directories' and 'example directory and its sub-directories'.
file.accessible.dir=userdata/scripts; D:/example;
// Restrict Sahi Pro's access to only the script directories configured in Sahi Pro.
file.accessible.dir=$scripts.dir;

Refer here for restricting remote access.