From 97706e54b96798a715982f73c9af3932f9ced2ef Mon Sep 17 00:00:00 2001 From: Justin Georgi Date: Mon, 25 Mar 2024 08:46:01 -0700 Subject: [PATCH] Improve model location determination Signed-off-by: Justin Georgi --- src/pages/detect.vue | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/pages/detect.vue b/src/pages/detect.vue index e11076d..c3340d0 100644 --- a/src/pages/detect.vue +++ b/src/pages/detect.vue @@ -165,26 +165,27 @@ created () { var loadOtherSettings = localStorage.getItem('otherSettings') if (loadOtherSettings) this.otherSettings = JSON.parse(loadOtherSettings) + let modelRoot = this.isCordova ? 'https://localhost' : (import.meta.env.PROD ? '.' : '..') switch (this.f7route.params.region) { case 'thorax': this.activeRegion = 0 this.detectorName = 'thorax' /* VITE setting */ - this.modelLocation = `../models/thorax${this.otherSettings.mini ? '-mini' : ''}/model.json` - this.miniLocation = `../models/thorax-mini/model.json` + this.modelLocation = `${modelRoot}/models/thorax${this.otherSettings.mini ? '-mini' : ''}/model.json` + this.miniLocation = `${modelRoot}/models/thorax-mini/model.json` /* PWA Build setting */ //this.modelLocation = `./models/thorax${this.otherSettings.mini ? '-mini' : ''}/model.json` - this.modelLocationCordova = `https://localhost/models/thorax${this.otherSettings.mini ? '-mini' : ''}/model.json` + this.modelLocationCordova = `${modelRoot}/models/thorax${this.otherSettings.mini ? '-mini' : ''}/model.json` break; case 'abdomen': this.activeRegion = 1 this.detectorName = 'abdomen' /* VITE setting */ - this.modelLocation = `../models/abdomen${this.otherSettings.mini ? '-mini' : ''}/model.json` - this.miniLocation = `../models/abdomen-mini/model.json` + this.modelLocation = `${modelRoot}/models/abdomen${this.otherSettings.mini ? '-mini' : ''}/model.json` + this.miniLocation = `${modelRoot}/models/abdomen-mini/model.json` /* PWA Build setting */ //this.modelLocation = `./models/abdomen${this.otherSettings.mini ? '-mini' : ''}/model.json` - this.modelLocationCordova = `https://localhost/models/abdomen${this.otherSettings.mini ? '-mini' : ''}/model.json` + this.modelLocationCordova = `${modelRoot}/models/abdomen${this.otherSettings.mini ? '-mini' : ''}/model.json` break; case 'limbs': this.activeRegion = 2