Skip to content

Commit 0c48260

Browse files
committed
Swap source when on forge
1 parent 1036b20 commit 0c48260

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

scripts/apps/IntelligentNpcsBrowser.mjs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,13 @@ export default class IntelligentNpcsBrowser extends Application {
200200
await this._createFolderIfMissing("modules/intelligent-npcs");
201201
await this._createFolderIfMissing("modules/intelligent-npcs/storage");
202202
await this._createFolderIfMissing("modules/intelligent-npcs/storage/images");
203-
let imageFolder = await FilePicker.browse("data", "modules/intelligent-npcs/storage/images");
203+
204+
let source = "data";
205+
if (typeof ForgeVTT != "undefined" && ForgeVTT.usingTheForge) {
206+
source = "forgevtt";
207+
}
208+
209+
let imageFolder = await FilePicker.browse(source, "modules/intelligent-npcs/storage/images");
204210
let matchingFile = imageFolder.files.find(x => x.endsWith(filename));
205211
if ( filename && matchingFile ) {
206212
img = matchingFile;
@@ -210,7 +216,7 @@ export default class IntelligentNpcsBrowser extends Application {
210216
let response = await fetch(img);
211217
let blob = await response.blob();
212218
let file = new File([blob], filename);
213-
let fileResponse = await FilePicker.upload("data", "modules/intelligent-npcs/storage/images", file, {});
219+
let fileResponse = await FilePicker.upload(source, "modules/intelligent-npcs/storage/images", file, {});
214220
img = fileResponse.path;
215221
}
216222

0 commit comments

Comments
 (0)