Skip to content

Commit 4b3028c

Browse files
authored
Fix the way CSP files are imported (#196)
Co-authored-by: Sarmishta Velury <[email protected]>
1 parent 0aa61e9 commit 4b3028c

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

cls/SourceControl/Git/Utils.cls

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1032,7 +1032,11 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A
10321032
set sc = routineMgr.%Save()
10331033
}
10341034
} else {
1035-
set sc = $system.OBJ.Load(filename,"-l-d")
1035+
if ($extract(InternalName, 1) = "/"){
1036+
set sc = ..ImportCSPFile(InternalName)
1037+
} else{
1038+
set sc = $system.OBJ.Load(filename,"-l-d")
1039+
}
10361040
}
10371041
if sc {
10381042
set sc = ..UpdateRoutineTSH(InternalName, fileTSH)
@@ -1050,6 +1054,23 @@ ClassMethod ImportItem(InternalName As %String, force As %Boolean = 0, verbose A
10501054
quit sc
10511055
}
10521056

1057+
ClassMethod ImportCSPFile(InternalName As %String) As %Status
1058+
{
1059+
set cspFile = $System.CSP.GetFileName(InternalName)
1060+
set srcFile = ..FullExternalName(InternalName)
1061+
set sc = $$$OK
1062+
1063+
if (cspFile=srcFile)||($$$isWINDOWS&&($ZCVT(cspFile,"l")=$ZCVT(srcFile,"l"))) {
1064+
Quit $$$OK
1065+
}
1066+
1067+
if '(##class(%File).Delete(cspFile) && ##class(%File).CopyFile(srcFile, cspFile)) {
1068+
set sc = $$$ERROR($$$GeneralError, "Unable to import '"_srcFile_"'")
1069+
}
1070+
1071+
Quit sc
1072+
}
1073+
10531074
ClassMethod ListItemsInFiles(ByRef itemList, ByRef err) As %Status
10541075
{
10551076
#define DoNotLoad 1

0 commit comments

Comments
 (0)