camerja
camerja copied to clipboard
Error: Directory
Hi I am getting this error: 14:30:57: [Error: Directory 'file:///data/user/0/host.exp.exponent/files/ExperienceData/%2540anonymous%252Fawesomeproject-61256c9a-b65e-45a2-b7ad-48b3fc298e0a/photos' could not be created.] Directory exists
I suppose that the promblem appears when it executes this: componentDidMount() { FileSystem.makeDirectoryAsync( FileSystem.documentDirectory + 'photos' ).catch(e => { console.log(e, 'Directory exists'); }); } So how can i fix this?
I think adding the options object with intermediates set to true should resolve. See below :)
async componentDidMount() {
try {
await FileSystem.makeDirectoryAsync(
`${FileSystem.documentDirectory}photos`,
{
intermediates: true,
}
)
} catch (e) {
console.log(e)
}
}
@gregbenner that worked! thanks.
I had this error message on an iPhone device:
could not be moved to ...
FYI: intermediates: true
means create intermediate directories as required (link). Same as running mkdir -p
on unix.