Commit 21136517 authored by Jerome Chauveau's avatar Jerome Chauveau
Browse files

extension .zip pour la route du plugin d'export !

parent 61de876c
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -6,12 +6,16 @@ import module namespace max.config = 'pddn/max/config' at '../../rxq/config.xqm'

declare
%rest:GET
%output:media-type('application/octet-stream')
%rest:path("/{$project}/export")
function max.plugin.sources_export:export($project){
%output:media-type("application/octet-stream")
%rest:path("/{$project}/{$archive}.zip")
function max.plugin.sources_export:export($project, $archive){
    if($project != $archive)
    then
        fn:error(xs:QName("err:sources_export"), "Archive does not exist :  '" || $archive||".zip'")
    else
        let $db := max.config:getProjectDBPath($project)
    let $tmpDir := file:create-temp-dir('max-export',$project)
        let $zipName := $project||'.zip'
        let $tmpDir := file:create-temp-dir('max-export',$project)
        let $dest := $tmpDir ||'/'||$zipName
        return (
                db:export($db, $tmpDir),
@@ -26,6 +30,7 @@ function max.plugin.sources_export:export($project){
                ),
                file:delete($tmpDir,true())
            )

};

declare %private function max.plugin.sources_export:makeZip($project,$directory, $dest){