123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475(*********************************************************************************)(* Chamo *)(* *)(* Copyright (C) 2003-2021 Institut National de Recherche en Informatique *)(* et en Automatique. All rights reserved. *)(* *)(* This program is free software; you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License version *)(* 3 as published by the Free Software Foundation. *)(* *)(* 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 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 *)(* *)(* Contact: Maxence.Guesdon@inria.fr *)(* *)(*********************************************************************************)(** Some configuration stuff of the editor. *)letlocal_dir_rc_file_prefix=".chamo."letlocal_dir_rc_filename=".chamo."^nameletgetenvvar=matchSys.getenvvarwith|exceptionNot_found->None|""->None|v->Somevlethome=trySys.getenv"HOME"withNot_found->""letlogin=trySys.getenv"USER"withNot_found->Filename.basenamehomeletrc_dir=letxdg_config_home=matchgetenv"XDG_CONFIG_HOME"with|Somed->d|None->Filename.concathome".config"inletd=Filename.concatxdg_config_home"chamo"inletexist=try(Unix.statd).Unix.st_kind=Unix.S_DIRwith_->falseinifnotexistthenbeginletcom=Printf.sprintf"mkdir -p %s"(Filename.quoted)in(matchSys.commandcomwith|0->()|_->prerr_endline(Printf.sprintf"Could not create configuration directory %s"d))end;dletrc_files=Filename.concatrc_dir("chamo."^s)letkeystates_wrappers=Ocf.Wrapper.listStk.Key.keystate_ocf_wrapperletbinding_wrappers=Ocf.Wrapper.(pairkeystates_wrappersstring)letocamlfind=ref"ocamlfind"letset_ocamlfinds=ocamlfind:=sletocamlfind()=!ocamlfind