-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3384b6a
commit d5f7de4
Showing
2 changed files
with
129 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Export generator="Cache" version="25"> | ||
<Class name="sc.all.sub"> | ||
<Description> | ||
Export different types of modules in different subfolders</Description> | ||
<Super>sc.all</Super> | ||
<TimeCreated>64245,54012</TimeCreated> | ||
|
||
<Method name="filename"> | ||
<Description><![CDATA[ | ||
test.dfi -> /dfi/test.dfi | ||
test.cls -> /cls/test.cls | ||
etc]]></Description> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec>code</FormalSpec> | ||
<Implementation><![CDATA[ | ||
s ext = $p( code, ".", * ), ext = $zcvt( ext, "l" ) | ||
#; for each type - different directory | ||
s wd = ..workdir() s:ext'="" wd = ##class(%File).NormalizeDirectory( ext, wd ) | ||
d:'##class(%File).DirectoryExists( wd ) ##class(%File).CreateDirectoryChain( wd ) | ||
s filename = ##class(%File).NormalizeFilename( code, wd ) | ||
#; for *.dfi filename can contain folders | ||
if ext = "dfi" { | ||
s path = ##class(%File).GetDirectory( filename ) | ||
d:'##class(%File).DirectoryExists( path ) ##class(%File).CreateDirectoryChain( path ) | ||
} | ||
Q filename | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="importUpdated"> | ||
<Description> | ||
import from workdir all files with ts newer than code ts in db</Description> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec><![CDATA[qspec="cku-d",&err="",recurse=1,&loaded="",verbose=1]]></FormalSpec> | ||
<ReturnType>%Status</ReturnType> | ||
<Implementation><![CDATA[ | ||
#define push(%dir) s dirs( $i( dirs ) ) = %dir | ||
#define next(%i,%dir) s %i=$o( dirs( "" ), 1, %dir ) k:%i'="" dirs(%i) | ||
#define isDirectory(%type) ( %type = "D" ) | ||
#define log w !, filename, " -> ", codename, " ", +sc | ||
s sc = 1, dirs = "", dir = ..workdir() $$$push(dir) | ||
s rs = ##class(%ResultSet).%New( "%Library.File:FileSet" ) | ||
for { $$$next(i,dir) Q:i="" Q:dir="" | ||
s sc = rs.Execute( dir, "*.*" ) Q:'sc | ||
while rs.Next() { | ||
s filename = rs.Name | ||
if $$$isDirectory( rs.Type ) { | ||
if ( recurse ) $$$push(filename) ;push directory | ||
continue | ||
} | ||
s filets = rs.DateModified | ||
s codename = ..codename( filename, .ext ) | ||
s codets = ..codets( codename, ext ) | ||
if ( filets '] codets ) continue | ||
/* | ||
w !, " ************* import ************** " | ||
w !, "file: ", filets | ||
w !, "code: ", codets | ||
*/ | ||
if ext = "dfi" { | ||
s sc = ##class(%DeepSee.UserLibrary.Utils).%Import( filename, 1, 0, 0, "", .loaded ) | ||
} else { | ||
s sc = $system.OBJ.Load( filename, qspec, .err, .loaded) | ||
} | ||
if verbose $$$log | ||
} | ||
} | ||
Q sc | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="codename"> | ||
<Description> | ||
presumable codename </Description> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec><![CDATA[filename,&ext=""]]></FormalSpec> | ||
<Implementation><![CDATA[ | ||
s ext = $p( filename, ".", * ), ext = $zcvt( ext, "l" ) | ||
s path = ##class(%File).NormalizeDirectory( ext, ..workdir() ) | ||
s codename = $p( filename, path, 2 ) | ||
if ext = "dfi" { | ||
s fullname = $tr( codename, "\", "/" ) ; return fullname for dfi in $$$IsWINDOWS | ||
Q $p( fullname, ".", 1, *-1 ) ;remove extension | ||
} | ||
Q codename | ||
]]></Implementation> | ||
</Method> | ||
|
||
<Method name="codets"> | ||
<ClassMethod>1</ClassMethod> | ||
<FormalSpec>codename,ext</FormalSpec> | ||
<Implementation><![CDATA[ | ||
s ts = "" | ||
if ext'="dfi" { | ||
s ts = ##class(%RoutineMgr).TS( codename ) | ||
} else { | ||
s sql="Select timeModified From %DeepSee_UserLibrary.FolderItem Where fullname = ?" | ||
s rs = ##class(%SQL.Statement).%ExecDirect( , sql, codename ) | ||
if rs.%Next() { | ||
s utcts = rs.timeModified | ||
s utch = $zdth( utcts, 3, , 3 ) ;utc internal format | ||
s loch = $zdth( utch, -3 ) ; utc to local timezone | ||
s ts = $zdt( loch, 3, ,0 ) ; local timestamp*/ | ||
} | ||
} | ||
Q $p( ts, "." ) ;remove ms | ||
]]></Implementation> | ||
</Method> | ||
</Class> | ||
</Export> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters