Browse Source

Code simplification

 - Replace self made function to read the file by a core one
Leo 10 years ago
parent
commit
70a75f7684
1 changed files with 1 additions and 9 deletions
  1. 1 9
      src/file_com.ml

+ 1 - 9
src/file_com.ml

@@ -38,14 +38,6 @@ open Core.Std;;
 
 
 (* Read settings and programs to launch from rc file *)
 (* Read settings and programs to launch from rc file *)
 
 
-(* Get string from file *)
-let string_f_file file =
-    let tmp_buffer = In_channel.create file in
-let content = In_channel.input_all tmp_buffer in
-(* Now, close file and return value *)
-In_channel.close tmp_buffer; content
-;;
-
 (* Return the configuration file template *)
 (* Return the configuration file template *)
 let rc_template () =
 let rc_template () =
   Settings_v.create_rc_file ~progs:[] ~settings:[]
   Settings_v.create_rc_file ~progs:[] ~settings:[]
@@ -69,5 +61,5 @@ let rec init_rc ~rc:rc_file =
   match (Sys.file_exists rc_file) with
   match (Sys.file_exists rc_file) with
     | `No -> create_rc_file ~name:rc_file; init_rc ~rc:rc_file;
     | `No -> create_rc_file ~name:rc_file; init_rc ~rc:rc_file;
     | `Unknown -> failwith "Error reading configuration file";
     | `Unknown -> failwith "Error reading configuration file";
-    | `Yes -> string_f_file rc_file |> Settings_j.rc_file_of_string
+    | `Yes -> In_channel.read_all rc_file |> Settings_j.rc_file_of_string
 ;;
 ;;