From c05a3cef2b5a2f8019546b624d204975bbbdad00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Todor=20Kondi=C4=87?= <todor.kondic@uni.lu>
Date: Tue, 5 May 2020 12:53:16 +0200
Subject: [PATCH] Modify write_conf and read_conf

* R/api.R(read_conf): The call of vrfy_conf removed due to some
  conflicts. Reinstate verification somewhere else.

* R/api.R(write_conf): Substitute conf with m argument.

(read_conf): Conflicts with the one in R/aip.R, so removed.
---
 R/api.R | 13 ++++++++-----
 R/mix.R | 14 +++++++++-----
 2 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/R/api.R b/R/api.R
index f71c1db..2c4fe6a 100644
--- a/R/api.R
+++ b/R/api.R
@@ -107,12 +107,15 @@ mk_comp_tab <- function(m) {
 }
 
 ##' @export
-read_conf <- function(fn_conf) {
-    assert(file.exists(fn_conf),msg=paste("Unable to read the configuration file:", fn_conf))
-    conf <- yaml::yaml.load_file(fn_conf)
-    conf <- vrfy_conf(conf)
-    conf
+read_conf <- function(fn) {
+    yaml::yaml.load_file(fn)
 }
+## read_conf <- function(fn_conf) {
+##     assert(file.exists(fn_conf),msg=paste("Unable to read the configuration file:", fn_conf))
+##     conf <- yaml::yaml.load_file(fn_conf)
+##     conf <- vrfy_conf(conf)
+##     conf
+## }
 
 ##' @export
 vrfy_conf <- function(conf) {
diff --git a/R/mix.R b/R/mix.R
index 30790e4..6c22ce7 100644
--- a/R/mix.R
+++ b/R/mix.R
@@ -596,12 +596,16 @@ read_setid <- function(fn,known,unk) {
 }
 
 
-write_conf <- function(conf,fn) {
-    yaml::write_yaml(x=conf,file=fn)
+write_conf <- function(m,fn) {
+    m$conf$data <- file.path(m$conf$project,FN_DATA_TAB)
+    yaml::write_yaml(x=m$conf,file=fn)
+    
+    
+    
 }
-
-read_conf <- function(fn) {
-    yaml::yaml.load_file(fn)
+write_state <- function(m,fn_conf) {
+    write_conf(m,fn_conf)
+    tab2file(tab=m$input$tab$mzml,file=file.path(m$conf$project,FN_DATA_TAB))
 }
 
 new_state <- function(conf,GUI) {
-- 
GitLab