refactor: make fileaccess state from union
refactor: do not use dynamic allocation where not needed
feat: add directory list
fix: some file access function types
refactor: fix inconsistency in file access function definitions
feat: add structure for dynamic file access