Skip to content

Commit

Permalink
Merge pull request #69 from burobrasil/gm/fix-character-importer
Browse files Browse the repository at this point in the history
  • Loading branch information
jmonteiro authored Oct 29, 2024
2 parents 24448d1 + df53d7c commit e34174a
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/module/api/characterImporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,17 @@ const _downloadAndSaveImage = async (url) => {
await FilePicker.browse('data', folderPath);
} catch (e) {
if (e.message.includes('does not exist or is not accessible')) {
await FilePicker.createDirectory('data', folderPath);
const parts = folderPath.split('/');
for (let i = 1; i <= parts.length; i++) {
const subPath = parts.slice(0, i).join('/');
try {
await FilePicker.createDirectory('data', subPath);
} catch (err) {
if (!err.message.includes('EEXIST')) {
throw err;
}
}
}
} else {
throw e;
}
Expand Down

0 comments on commit e34174a

Please sign in to comment.