View Single Post
Solokiller
Senior Member
Join Date: Sep 2015
Old 12-02-2016 , 09:14   Re: AngelScript Mod Loader
Reply With Quote #14

The filesystem now loads its settings from a file, if present. Otherwise, default settings are applied.

I've also replaced the extension blacklist with a regular expression filter.

For example:
Code:
filter
{
        //Never allow access to cfgs in the main directory.
        expression "^([^/]|\\.\\/)*\\.cfg$"
        flag INVERT
}
This prevents scripts from opening cfg files in the main directory. They can't open anything in the main directory anyway by default, but if you allow it this will let you filter out specific extensions, filenames, paths, etc.

As an example, if a script tries to open "config.cfg":

Code:
[FILESYSTEM] File "config.cfg" failed filter 1/3
[FILESYSTEM] READ access denied for "config.cfg": Failed to pass filters
There are 3 filters defined right now, and it failed the first filter. It also tells you whether it tried to read or write. I might add flags to only use filters for read or write operations if that's necessary.

Expressions should take into account the possibility that a path starts with or without "./", hence why the expression checks both.

The INVERT flag tells the code to invert the result of the match. By default, files must match every filter, so inverting the result causes it to deny access if the filter matches.

Last edited by Solokiller; 12-02-2016 at 09:15.
Solokiller is offline