Check permissions unix-way

Check if path write flags are enabled for the current
user, group or everyone else.

The permission logic was failing during the "first time"
scenario, where the activity was opened for the first time,
because there was no data file to read from in the first
place.

This patch solves the logic and also does proper permission
checking.

Signed-off-by: Martin Abente Lahaye <tch@sugarlabs.org>