[DeivceHome] Use the path /res/wsa for tmg service app 35/266635/4 submit/tizen/20211116.160020
authorYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 16 Nov 2021 09:00:45 +0000 (01:00 -0800)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 16 Nov 2021 09:09:38 +0000 (01:09 -0800)
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 <kenshin.choi@samsung.com>
device_home/service/service.js

index 289fd62..138dd23 100755 (executable)
@@ -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);
   });