move string-related utils into String_utils
[hiphop-php.git] / hphp / hack / src / server / serverFiles.ml
blob0ad5b4b2db184ec40c59cf45d8a4842699b9ee92
1 (**
2 * Copyright (c) 2015, Facebook, Inc.
3 * All rights reserved.
5 * This source code is licensed under the BSD-style license found in the
6 * LICENSE file in the "hack" directory of this source tree. An additional grant
7 * of patent rights can be found in the PATENTS file in the same directory.
9 *)
11 open Utils
12 open String_utils
14 let path_of_root root extension =
15 (* TODO: move this to places that write this file *)
16 Sys_utils.mkdir_no_fail GlobalConfig.tmp_dir;
17 let root_part = Path.slash_escaped_string_of_path root in
18 Filename.concat GlobalConfig.tmp_dir (spf "%s.%s" root_part extension)
20 let is_of_root root fn =
21 let root_part = Path.slash_escaped_string_of_path root in
22 string_starts_with fn (Filename.concat GlobalConfig.tmp_dir root_part)
24 (**
25 * Lock on this file will be held after the server has finished initializing.
26 * *)
27 let init_complete_file root = path_of_root root "init_complete"
28 let lock_file root = path_of_root root "lock"
29 let log_link root = path_of_root root "log"
30 let pids_file root = path_of_root root "pids"
31 let socket_file root = path_of_root root "sock"
32 let dfind_log root = path_of_root root "dfind"
33 let load_log root = path_of_root root "load"
35 let monitor_log_link root = path_of_root root "monitor_log"