Skip to content

Commit 1c93e96

Browse files
authored
Merge pull request #129 from jakcpto/master
Prefix Support for Addons and Themes
2 parents cf70593 + 79254da commit 1c93e96

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

MDX2JSON/REST.cls

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,12 +421,20 @@ ClassMethod WritePivotVariablesForCube(Cube As %String) As %Status
421421
ClassMethod WriteAddons() As %Status
422422
{
423423
#dim sc As %Status = $$$OK
424-
425-
set app = "/dsw"
424+
425+
set currentApp = $ZConvert($Get(%request.CgiEnvs("SCRIPT_NAME"), ""), "L")
426+
set prefix = $piece(currentApp, "/mdx2json", 1)
427+
set app = prefix _ "/dsw"
426428
set path = $system.CSP.GetFileName(app _ "/")
427429
set path = ##class(%File).NormalizeDirectory(path)
428430
set path = ##class(%File).SubDirectoryName(path, "addons", $$$YES)
429431
set url = app _ "/addons/"
432+
433+
// Check if path exists
434+
if '##class(%File).Exists(path) {
435+
set sc = $$$ERROR($$$GeneralError, "Addons directory does not exist: "_path_". Probably different prefixes for MDX2JSON and DSW applications.")
436+
quit sc
437+
}
430438

431439
#dim rs As %SQL.ClassQueryResultSet = ##class(%File).FileSetFunc(path, "*.js")
432440

@@ -447,12 +455,20 @@ ClassMethod WriteThemes() As %Status
447455
{
448456
#dim sc As %Status = $$$OK
449457

450-
set app = "/dsw"
458+
set currentApp = $ZConvert($Get(%request.CgiEnvs("SCRIPT_NAME"), ""), "L")
459+
set prefix = $piece(currentApp, "/mdx2json", 1)
460+
set app = prefix _ "/dsw"
451461
set path = $system.CSP.GetFileName(app _ "/")
452462
set path = ##class(%File).NormalizeDirectory(path)
453463
set path = ##class(%File).SubDirectoryName(path, "themes", $$$YES)
454464
set url = app _ "/themes/"
455465

466+
// Check if path exists
467+
if '##class(%File).Exists(path) {
468+
set sc = $$$ERROR($$$GeneralError, "Themes directory does not exist: "_path_". Probably different prefixes for MDX2JSON and DSW applications.")
469+
quit sc
470+
}
471+
456472
#dim rs As %SQL.ClassQueryResultSet = ##class(%File).FileSetFunc(path, "*.css")
457473

458474
set list = $$$NewDynDTList
@@ -474,4 +490,4 @@ ClassMethod WriteJSONfromKPI() As %Status [ CodeMode = objectgenerator ]
474490
do %code.Write(base)
475491
}
476492

477-
}
493+
}

0 commit comments

Comments
 (0)