dba/files
library moduleR
Summary
Change directory.
- Tags
Author: Christian Grün, BaseX Team 2005-21, BSD License
__source : files/dir-change.xqm
Imports
This module is imported by 0 modules. It imports 1 modules.
Variables
Functions
4.1 dba:dir-change
Arities: dba:dir-change#1R
dba:dir-change
(
$dir
as
xs:string
)
as
element(rest:response)
- dir
as
xs:string
directory
element(rest:response)
redirection
Invokes 7 functions from 4 modules
- config:directory#0
- config:directory#1
- config:query#1
- {http://basex.org/modules/web}redirect#1
- {http://expath.org/ns/file}dir-separator#0
- {http://expath.org/ns/file}path-to-native#1
- {http://www.w3.org/2005/xpath-functions}contains#2
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:
Prefix | Uri |
---|---|
config | dba/config |
dba | dba/files 2 3 4 5 6 7 8 |
rest | http://exquery.org/ns/restxq |
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)
};