package ojs_filetree
Using filetrees in ojs_base applications, common part
Install
Dune Dependency
Authors
Maintainers
Sources
ojs-base-0.7.0.tar.bz2
md5=85b8a0746e9be8c20cf082f2573b5895
sha512=ec707820ff69ddbf9c631cf6a1c8748e82346daded1a4f73c5702128d07858f915e62d529e5fec01e99263f33eefb1586067341c058535806e0092b9d040644a
doc/src/ojs_filetree.server/files.ml.html
Source file files.ml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
(*********************************************************************************) (* Ojs-base *) (* *) (* Copyright (C) 2014-2021 INRIA. All rights reserved. *) (* *) (* This program is free software; you can redistribute it and/or modify *) (* it under the terms of the GNU General Public License as *) (* published by the Free Software Foundation, version 3 of the License. *) (* *) (* This program is distributed in the hope that it will be useful, *) (* but WITHOUT ANY WARRANTY; without even the implied warranty of *) (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) (* GNU Library General Public License for more details. *) (* *) (* You should have received a copy of the GNU General Public *) (* License along with this program; if not, write to the Free Software *) (* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA *) (* 02111-1307 USA *) (* *) (* As a special exception, you have permission to link this program *) (* with the OCaml compiler and distribute executables, as long as you *) (* follow the requirements of the GNU GPL in regard to all of the *) (* software in the executable aside from the OCaml compiler. *) (* *) (* Contact: Maxence.Guesdon@inria.fr *) (* *) (*********************************************************************************) (** *) let is_dir file = (Unix.stat file).Unix.st_kind = Unix.S_DIR let file_trees_of_dir ?(filepred=fun _ -> true) root_dir = let root_dir = Ojs_base.Path.to_string root_dir in let base s = Filename.basename s in let filepred s = filepred (Ojs_base.Path.of_string s) in let rec iter dir = let entries = Find.find_list Find.Stderr [dir] [ Find.Maxdepth 1 ; Find.Predicate filepred ; ] in let pred s = s <> dir && (Filename.basename s <> Filename.current_dir_name) && (Filename.basename s <> Filename.parent_dir_name) in let entries = List.filter pred entries in let entries = List.sort String.compare entries in let (dirs, files) = List.partition is_dir entries in let dir s = `Dir (base s, iter s) in let file s = `File (base s, Magic_mime.lookup s) in (List.map dir dirs) @ (List.map file files) in iter root_dir
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>