fix bug that app cannot write files in resourceDirectory