dba/files  library module
R

Summary

Change directory.
Tags

Author: Christian Grün, BaseX Team 2005-21, BSD License

__source : files/dir-change.xqm

Related documents
ViewDescriptionFormat
xqdocxqDoc xml file from the source modulexml
xqparsexqparse xml file from the source modulexml

Imports

This module is imported by 0 modules. It imports 1 modules.

(None)
imports
this
imports

Variables

3.1 $dba:CAT

Summary
Top category
Type
xs:string

Functions

4.1 dba:dir-change

Arities: dba:dir-change#1R

Summary
Changes the directory.
Signature
dba:dir-change ( $dir as xs:string )  as element(rest:response)
Parameters
  • dir as xs:string directory
Return
  • element(rest:response)redirection
Invokes 7 functions from 4 modules
Invoked by 0 functions from 0 modules
    Annotations
    %rest:path('/dba/dir-change')
    %rest:query-param('dir','{$dir}')
    Source ( 13 lines)
    function dba:dir-change(
      $dir  as xs:string
    ) as element(rest:response) {
      config:directory(
        if(contains($dir, file:dir-separator())) then (
          $dir
        ) else (
          file:path-to-native(config:directory() || $dir || '/')
        )
      ),
      config:query(''),
      web:redirect($dba:CAT)
    }

    Namespaces

    The following namespaces are defined:

    PrefixUri
    configdba/config
    dbadba/files 2 3 4 5 6 7 8
    resthttp://exquery.org/ns/restxq

    6 RestXQ

    Paths defined 1.

    PathMethodFunction
    /dba/dir-changedba:dir-change#1

    Source Code

    (:~
     : Change directory.
     :
     : @author Christian Grün, BaseX Team 2005-21, BSD License
     :)
    module namespace dba = 'dba/files';
    
    import module namespace config = 'dba/config' at '../lib/config.xqm';
    
    (:~ Top category :)
    declare variable $dba:CAT := 'files';
    
    (:~
     : Changes the directory.
     : @param  $dir  directory
     : @return redirection
     :)
    declare
      %rest:path('/dba/dir-change')
      %rest:query-param('dir', '{$dir}')
    function dba:dir-change(
      $dir  as xs:string
    ) as element(rest:response) {
      config:directory(
        if(contains($dir, file:dir-separator())) then (
          $dir
        ) else (
          file:path-to-native(config:directory() || $dir || '/')
        )
      ),
      config:query(''),
      web:redirect($dba:CAT)
    };