Directory and files are neither a file or a directory on Basex 9.3.2 when read from Docker volume

Friday, 8 May 2020 · 3 messages · last reply 14 May 2020
FB
France Baril8 May 2020 16:19 #
Hi, Here is my issue. I create a new container with Basex 9.3.2 I add a volume ContentDBs under my basex directory ContentDBs has 2 directories and 1 files I run this code from an xqm:
let $src-dir-items := file:list('ContentDBs')
    let $debug := file:append('debug-a.xml', 'count: ' ||
count($src-dir-items) || '
')
    let $dirs :=
        for $i in $src-dir-items
        (: Bug items are neither a dir or a file !? Because volume from
docker? :)
        let $debug := file:append('debug-a.xml', 'item: ' || $i || ' is
dir: ' || file:is-dir($i) ||  '
')
        let $debug := file:append('debug-a.xml', 'item: ' || $i || ' is
file: ' || file:is-file($i) ||  '
')
        return $i
In the debug file, I get. - The count for items is 3 - For all items, is-dir and is-file are false. I get a similar error if I try to db:create from one of the folders, it seems to recognize that I have a folder, but it chokes on subfolders with: Resource 'js/' does not exist.
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com
CG
Christian Grün11 May 2020 09:29 #
Hi France, Does your code work without Docker?
Quoted text · France Baril · 1 line
> let $src-dir-items := file:list('ContentDBs')
...
Quoted text · France Baril · 3 lines
> let $debug := file:append('debug-a.xml', 'item: ' || $i || ' is dir: ' || file:is-dir($i) || '
') > let $debug := file:append('debug-a.xml', 'item: ' || $i || ' is file: ' || file:is-file($i) || '
') > return $i
Please note that file:list only returns the name of the files, not the paths. You can try file:children instead [1]. Hope this helps, Christian [1] https://docs.basex.org/wiki/File_Module#file:children
FB
France Baril14 May 2020 17:33 #
Ah! This resolved that! Thanks!
Quoted text · Christian Grün · 22 lines
On Mon, May 11, 2020 at 8:29 AM Christian Grün <christian.gruen at gmail.com> wrote: > Hi France, > > Does your code work without Docker? > > > let $src-dir-items := file:list('ContentDBs') > ... > > let $debug := file:append('debug-a.xml', 'item: ' || $i || ' is > dir: ' || file:is-dir($i) || '&#10;') > > let $debug := file:append('debug-a.xml', 'item: ' || $i || ' is > file: ' || file:is-file($i) || '&#10;') > > return $i > > Please note that file:list only returns the name of the files, not the > paths. You can try file:children instead [1]. > > Hope this helps, > Christian > > [1] https://docs.basex.org/wiki/File_Module#file:children >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com

⚡Generated with XQuery