@@ -1239,24 +1239,32 @@ ClassMethod Name(InternalName As %String) As %String
12391239 // Grab the actual name
12401240 set actualName = $classmethod (docclass ," GetOther" ,InternalName )
12411241 // The actualName is only valid if we get a single .cls as a result
1242- if actualName '[" ," , $zconvert ($piece (actualName ," ." ,$length (actualName ," ." ))," U" )=" CLS" {
1242+ if ( actualName '[" ," ) && ( $zconvert ($piece (actualName ," ." ,$length (actualName ," ." ))," U" )=" CLS" ) {
12431243 // We use what GetOther() gives us, thus Demo.Loan.FindRateProcess.bpl becomes Demo.Loan.FindRateProcess.cls
12441244 set InternalName = actualName
12451245 }
12461246 }
12471247 }
12481248
1249- if $$CheckProtect ^%qccServer (InternalName ) quit " "
1250- set nam =$piece (InternalName ," ." ,1 ,*-1 ),ext =$piece (InternalName ," ." ,*),ext =$zconvert (ext ," u" )
1251- if nam =" " ||(ext =" " ) quit " "
1249+ if $$CheckProtect ^%qccServer (InternalName ) {
1250+ quit " "
1251+ }
1252+
1253+ set nam =$piece (InternalName ," ." ,1 ,*-1 )
1254+ set ext =$zconvert ($piece (InternalName ," ." ,*)," u" )
1255+
1256+ if (nam =" " )||(ext =" " ){
1257+ quit " "
1258+ }
1259+
12521260 // Any CSP items should be matched against the "/CSP/" mapping in ^Sources
12531261 if InternalName [" /" {
12541262 set filename =$$GetFilename ^%apiCSP (InternalName )
12551263 //Find if this csp file is located within the ^Sources tree, and return appropriate value
1256- if $$$isWINDOWS {
1257- if $zconvert ( $extract ( filename , 1 , $length ($$$SourceRoot)), " l " )= $zconvert ($$$SourceRoot, " l " ) quit $extract (filename ,$length ($$$SourceRoot)+1 ,*)
1258- } else {
1259- if $extract ( filename , 1 , $length ($$$SourceRoot))=$$$SourceRoot quit $extract (filename ,$length ($$$SourceRoot)+1 ,*)
1264+ if ( $$$isWINDOWS) && ( $zconvert ( $extract ( filename , 1 , $length ($$$SourceRoot)), " l " )= $zconvert ($$$SourceRoot, " l " )) {
1265+ quit $extract (filename ,$length ($$$SourceRoot)+1 ,*)
1266+ } elseif $extract ( filename , 1 , $length ($$$SourceRoot))=$$$SourceRoot {
1267+ quit $extract (filename ,$length ($$$SourceRoot)+1 ,*)
12601268 }
12611269 //Do not support manipulating files in the /itemsetsourcelink* csp app which are not inside of the namespace's ^Sources tree
12621270 if InternalName [" itemsetsourcelink" {
@@ -1266,29 +1274,55 @@ ClassMethod Name(InternalName As %String) As %String
12661274 // Any CSP items should be matched against the "/CSP/" mapping if the file is not stored in the ^Sources tree
12671275 set ext =" /CSP/"
12681276 }
1269- if ext =" PRJ" ,nam [" Default_" quit " "
1270- if ext =" CLS" ,$$$defClassKeyGet(nam ,$$$cCLASSgeneratedby)'=" " quit " "
1271- set default =0
1272- set p =$order ($$$SourceMapping(ext ,nam )) for set p =$order ($$$SourceMapping(ext ,p ),-1 ) quit :p =" " if $extract (nam ,1 ,$length (p ))=p ,$data (^Sources (ext ,p ),found ) quit
1273- if $data (found )=0 ,$data ($$$SourceMapping(ext ," *" ),found ),'$$$GetSourceMapping(ext ," *" ," NoFolders" ) set default =1
1274- if $data (found )=0 quit " "
1277+
1278+ if (ext =" PRJ" ) && (nam [" Default_" ){
1279+ quit " "
1280+ }
1281+
1282+ if (ext =" CLS" ) && ($$$defClassKeyGet(nam ,$$$cCLASSgeneratedby)'=" " ){
1283+ quit " "
1284+ }
1285+
1286+ set default =1
1287+ set p =$order ($$$SourceMapping(ext ,nam ))
1288+ for {
1289+ set p =$order ($$$SourceMapping(ext ,p ),-1 )
1290+ quit :p =" "
1291+ if ($extract (nam ,1 ,$length (p ))=p ) && ($data (^Sources (ext ,p ),found )){
1292+ quit
1293+ }
1294+ }
1295+ if ($data (found )=0 ) && ($data ($$$SourceMapping(ext ," *" ),found )) && ('$$$GetSourceMapping(ext ," *" ," NoFolders" )){
1296+ set default =0
1297+
1298+ } elseif $data (found )=0 {
1299+ set found = $zconvert (ext ," L" )_" /"
1300+ }
1301+
12751302 if InternalName [" /" {
12761303 // If no specific mapping was specified (p=""), then return the whole csp filename; otherwise return the name without the mapped piece
12771304 set InternalName =$extract (InternalName ,$length (p )+2 ,*)
12781305 quit $translate (found _$translate (InternalName ," %" ," _" )," \" ," /" )
1279- }
1280- if (ext =" DFI" ) {
1306+
1307+ } elseif (ext =" DFI" ) {
12811308 // expected format is <folderName>-<itemName>.<itemType>.DFI; will map to an external file named <folderName>/<itemName>.<itemType>.xml
12821309 // replace the first '-' with '/' to translate Item Folder into subfolder on disk and leave the other dashes as dashes; converts spaces to '_'
12831310 quit $translate (found _$replace ($translate (nam ," % " ," __" )," -" ," /" ,1 ,1 )_" .xml" ," \" ," /" )
1284- }
1285- if ext =" CLS" ||(ext =" PRJ" )||(usertype &&(##class (%RoutineMgr ).UserType (InternalName ))) {
1311+
1312+ } elseif ext =" CLS" ||(ext =" PRJ" )||(usertype &&(##class (%RoutineMgr ).UserType (InternalName ))) {
12861313 set nam =$translate (nam ," %" )
1287- if '$$$GetSourceMapping(ext ," *" ," NoFolders" ) set nam =$translate (nam ," ." ," /" )
1314+ if '$$$GetSourceMapping(ext ," *" ," NoFolders" ){
1315+ set nam =$translate (nam ," ." ," /" )
1316+ }
12881317 #; If match ends in '`' character use UDL/CLS format rather than XML format
1289- return $translate (found _nam _" .cls" ," \" ," /" )
1318+ return $translate (found _nam _" ." _$zconvert (ext , " l" )," \" ," /" )
1319+ }
1320+
1321+ if ('default ){
1322+ quit $translate ($get (found )_$translate (nam ," %." ," _/" )_" ." _$zconvert (ext ," l" )," \" ," /" )
1323+ } else {
1324+ quit $translate ($get (found )_nam _" ." _$zconvert (ext ," l" )," \" ," /" )
12901325 }
1291- quit $translate ($get (found )_$translate (nam ," %." ," _/" )_" ." _$zconvert (ext ," l" )," \" ," /" )
12921326}
12931327
12941328/*
@@ -1377,10 +1411,10 @@ ClassMethod NameToInternalName(Name, IgnorePercent = 1, IgnoreNonexistent = 1) A
13771411 }
13781412 if (InternalName =" " ) {
13791413 //take our best guess based on the document extension mapped to that subdirectory
1380- set nam =$piece (nam ," ." ,1 , $length ( nam , " . " ) -1 )
1414+ set nam =$piece (nam ," ." ,1 * -1 )
13811415 set nam =$translate (nam ," _/" ," %." )
1382- set InternalName =nam _" ." _ ext
1383- if (ext = " CLS " ) {
1416+ set InternalName =nam _" ." _ fileExt
1417+ if (fileExt = " cls " ) {
13841418 // special handling for possible collissions between % and non-% classes of the same name
13851419 set alternateInternalName =" %" _InternalName
13861420 set primaryExists =##class (%RoutineMgr ).Exists (InternalName ), alternateExists =##class (%RoutineMgr ).Exists (alternateInternalName )
0 commit comments