sync with vsc-base
implement read_file and write_file functions for 'safely' reading/writing files, and use them