Sha256: 20f2a8f542ea763f4b8c373bc4264ef719012a258aa67519a696eaa3d937509a

Contents?: true

Size: 617 Bytes

Versions: 219

Compression:

Stored size: 617 Bytes

Contents

open Core

let mkdir_if_not_present dir =
  if Sys.file_exists dir = `No 
  then begin
    Unix.mkdir dir;
    print_endline @@ "Storing generated files in " ^ dir
  end 
  else ()

let backup ~(base_folder: string) ~(slug: string) ~(contents: string): bool =
  mkdir_if_not_present base_folder;
  let path = Filename.concat base_folder slug in
  let matches_contents =
    Option.try_with (fun () -> In_channel.read_all path)
    |> Option.map ~f:(String.equal contents)
    |> Option.value ~default:false 
  in
  if matches_contents
  then false
  else begin
    Out_channel.write_all path contents; 
    true
  end

Version data entries

219 entries across 219 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.179 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.178 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.177 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.176 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.175 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.174 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.173 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.172 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.171 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.170 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.169 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.167 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.166 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.165 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.164 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.163 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.162 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.161 tracks/ocaml/tools/test-generator/src/files.ml
trackler-2.2.1.160 tracks/ocaml/tools/test-generator/src/files.ml