From e6ff3d258e339b27fa8b52870d69ecc66ed3aeab Mon Sep 17 00:00:00 2001 From: Youngsoo Choi Date: Tue, 16 Nov 2021 01:00:45 -0800 Subject: [PATCH] [DeivceHome] Use the path /res/wsa for tmg service app When installing wgt app, service is mounted on /res/wgt but when installing tmg app on TV, service is mounted on /res/wsa. Change-Id: I82a3203cd6e0a652319b7531028aa119f36c4fd3 Signed-off-by: Youngsoo Choi --- device_home/service/service.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/device_home/service/service.js b/device_home/service/service.js index 289fd62..138dd23 100755 --- a/device_home/service/service.js +++ b/device_home/service/service.js @@ -1,6 +1,7 @@ 'use strict'; const express = require('express'); +const fs = require('fs'); const http = require('http'); const path = require('path'); const relayServer = require('./relay-server.js'); @@ -40,6 +41,7 @@ var dataApps = []; var clientRouter = express.Router(); var httpserver, evtEmit; var platform_app_path = '/opt/usr/globalapps'; +var platform_client_res_path = '/res/wgt/client'; var serverAppId = ''; var urlParam = ''; var g = { @@ -354,7 +356,10 @@ var HTTPserverStart = function() { console.log(`${TAG} __dirname: ${__dirname}`); if (is_tv) { - platform_app_path = '/opt/usr/apps' + platform_app_path = '/opt/usr/apps'; + if (!fs.existsSync(path.join(__dirname, platform_client_res_path))) { + platform_client_res_path = '/res/wsa/client'; + } console.log(`${TAG} TV Profile`); } @@ -425,7 +430,7 @@ var HTTPserverStart = function() { clientRouter.get('/*', function(req, res) { const file = req.originalUrl.replace('/client/', '').replace(/\?.+$/, ''); const pkgId = webapis.getPackageId(); - const fullPath = require('path').join(g.baseDir, pkgId, '/res/wgt/client', file); + const fullPath = require('path').join(g.baseDir, pkgId, platform_client_res_path, file); console.log(`${TAG} pkgId: ${pkgId}, fullPath: ${fullPath}`); res.sendFile(fullPath); }); -- 2.7.4