void fileWriteCheck(String filePath, AddOnModel addOnModel) {
        File request;
        try {
            request =  new File(filePath).getCanonicalFile();
        } catch (IOException e) {
            error("Error getting canonical path", e);
            throw getException(filePath);
        }

        isForbidden(request, addOnModel);

        boolean success = false;
        if (allowedWriteDirectories.stream()
                .anyMatch(compare -> request.toPath().startsWith(compare.toPath()))) {
            success = true;
        }

        for (String name : forbiddenWriteFilesNames) {
            if (request.getName().equals(name)) {
                success = false;
            }
        }

        if (!success) {
            throw getException(filePath);
        }

        if (!getSecurityManager().getSecureAccess().checkForExistingFileOrDirectory(request.toString())
                || getSecurityManager().getSecureAccess().checkForDirectory(request.toString())) {
            return;
        }
    }
void fileWriteCheck ( String filePath , AddOnModel addOnModel ) { File request ; try { request = new File ( filePath ) . getCanonicalFile ( ) ; } catch ( IOException e ) { error ( "Error getting canonical path" , e ) ; throw getException ( filePath ) ; } isForbidden ( request , addOnModel ) ; boolean success = false ; if ( allowedWriteDirectories . stream ( ) . anyMatch ( compare -> request . toPath ( ) . startsWith ( compare . toPath ( ) ) ) ) { success = true ; } for ( String name : forbiddenWriteFilesNames ) { if ( request . getName ( ) . equals ( name ) ) { success = false ; } } if ( ! success ) { throw getException ( filePath ) ; } if ( ! getSecurityManager ( ) . getSecureAccess ( ) . checkForExistingFileOrDirectory ( request . toString ( ) ) || getSecurityManager ( ) . getSecureAccess ( ) . checkForDirectory ( request . toString ( ) ) ) { return ; } }
Determines if the file at the given file path is safe to write to in all aspects, if so returns true, else false

@param filePath the path to the file to write to
@param addOnModel the AddonModel