remove most of the debugging features, because these are depracted

This commit is contained in:
hollorol 2018-05-16 00:20:09 +02:00
parent 7164638d08
commit 471dbcc22a
3 changed files with 62 additions and 55 deletions

View File

@ -54,21 +54,18 @@ getOutFiles <- function(outputLoc, outputNames){
#'@return Output files with their paths #'@return Output files with their paths
#'@keywords internal #'@keywords internal
stampAndDir <- function(outputLoc,names,stampDir, wrongDir, type="output", errorsign){ stampAndDir <- function(outputLoc,names,stampDir, wrongDir, type="output", errorsign, logfiles){
switch(type, switch(type,
"output" = ( "output" = (
file.copy(file.path(outputLoc,names) file.copy(file.path(outputLoc,names)
,file.path(stampDir,paste0((stamp(stampDir)+1),"-",names))) ), ,file.path(stampDir,paste0((stamp(stampDir)+1),"-",names))) ),
"epc" = (function (){ "general" = (function (){
stampnum <- stamp(stampDir) stampnum <- stamp(stampDir)
lapply(names,function (x) file.copy(from = x ,to=paste(stampDir,"/",(stampnum+1),"-", basename(x),sep=""))) lapply(names,function (x) file.copy(from = x ,to=paste(stampDir,"/",(stampnum+1),"-", basename(x),sep="")))
if(errorsign==1){ if(errorsign==1){
lapply(names, function (x) file.copy(from = paste(stampDir,"/",(stampnum+1),"-",basename(x),sep=""), to=wrongDir))}})(), lapply(names, function (x) file.copy(from = paste(stampDir,"/",(stampnum+1),"-",basename(x),sep=""), to=wrongDir))}})()
"log" = (
file.rename(names
,file.path(stampDir,paste0((stamp(stampDir)+1),"-",basename(names))))
)
) )
} }

View File

@ -44,8 +44,8 @@ calibMuso <- function(settings,parameters=NULL, timee="d", debugging=FALSE, logf
if((debugging=="stamplog")|(debugging==TRUE)){#If debugging option turned on if((debugging=="stamplog")|(debugging==TRUE)){#If debugging option turned on
#If log or ERROR directory does not exists create it! #If log or ERROR directory does not exists create it!
dirName<-paste(inputLoc,"LOG",sep="") dirName<-file.path(inputLoc,"LOG")
dirERROR<-paste(inputLoc,"ERROR",sep="") dirERROR<-file.path(inputLoc,"ERROR")
if(!dir.exists(dirName)){ if(!dir.exists(dirName)){
dir.create(dirName) dir.create(dirName)
@ -55,6 +55,7 @@ calibMuso <- function(settings,parameters=NULL, timee="d", debugging=FALSE, logf
dir.create(dirERROR) dir.create(dirERROR)
} }
} }
if(keepEpc) { if(keepEpc) {
epcdir <- dirname(epc[1]) epcdir <- dirname(epc[1])
print(epcdir) print(epcdir)
@ -218,53 +219,17 @@ calibMuso <- function(settings,parameters=NULL, timee="d", debugging=FALSE, logf
stop("Why are you playing with my nervs? Seriously? You hold your epc-s in different folders?") stop("Why are you playing with my nervs? Seriously? You hold your epc-s in different folders?")
} else { } else {
stampAndDir(stampDir=EPCS,wrongDir=WRONGEPC,names=epc,type="epc",errorsig=errorsign) stampAndDir(stampDir=EPCS,wrongDir=WRONGEPC,names=epc,type="general",errorsign=errorsign,logfiles=logfiles)
} }
} }
if(debugging==TRUE){
logfiles <- file.path(outputLoc,logfiles)
stampAndDir(stampDir=dirName, wrongDir=dirERROR, names=logfiles, type="general",errorsign=errorsign,logfiles=logfiles)}
if(debugging=="stamplog"){
stampnum<-stamp(dirName)
if(inputLoc==outputLoc){
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep=""), to=paste(dirName, "/",(stampnum+1),"-",x,sep="")))
} else {
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep="/"), to=paste(dirName, "/",(stampnum+1),"-",x,sep="")))
}
if(errorsign==1){
lapply( logfiles, function (x) file.copy(from=paste(dirName, "/",(stampnum+1),"-",x,sep=""), to=dirERROR ))}
} else { if(debugging){
if(is.null(logfilename)){
if(inputLoc==outputLoc){
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep=""), to=paste(dirName,"/", x, sep="")))
} else {
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep="/"), to=paste(dirName,"/", x, sep="")))
}
if(errorsign==1){
lapply( logfiles, function (x) file.copy(from=paste(dirName,"/", x, sep=""), to=dirERROR))
}
} else {
if(inputLoc==outputLoc){#These are very ugly solutions for a string problem: inputLoc: "./", if outputLoc equalent of inputLoc, it ends with "/", the string manipulation can not handle this. The better solution is easy, but I dont have enough time(Roland Hollo's)
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep=""), to=paste(dirName, "/",logfilename,"-",x,sep="")))
} else {
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep="/"), to=paste(dirName, "/",logfilename,"-",x,sep="")))
}
if(errorsign==1){
lapply( logfiles, function (x) file.copy(from=paste(dirName, "/",logfilename,"-",x,sep=""), to=dirERROR))
}
}
}}
#cleanupMuso(location=outputLoc,deep = FALSE) #cleanupMuso(location=outputLoc,deep = FALSE)
if(errorsign==1){ if(errorsign==1){
@ -280,11 +245,11 @@ calibMuso <- function(settings,parameters=NULL, timee="d", debugging=FALSE, logf
if(leapYear){ if(leapYear){
Reva <- corrigMuso(settings,Reva) Reva <- corrigMuso(settings,Reva)
rownames(Reva) <- musoDate(settings) rownames(Reva) <- musoDate(settings)
} else { } else {
rownames(Reva) <- musoDate(settings, corrigated=FALSE) rownames(Reva) <- musoDate(settings, corrigated=FALSE)
} }

View File

@ -305,3 +305,48 @@ getyearlyout<-function(settings){
## if(errorsign==1){ ## if(errorsign==1){
## lapply(epc, function (x) file.copy(from = paste(EPCS,"/",(stampnum+1),"-",basename(x),sep=""), to=WRONGEPC)) ## lapply(epc, function (x) file.copy(from = paste(EPCS,"/",(stampnum+1),"-",basename(x),sep=""), to=WRONGEPC))
## } ## }
## stampnum<-stamp(dirName)
## if(inputLoc==outputLoc){
## lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep=""), to=paste(dirName, "/",(stampnum+1),"-",x,sep="")))
## } else {
## lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep="/"), to=paste(dirName, "/",(stampnum+1),"-",x,sep="")))
## }
## if(errorsign==1){
## lapply( logfiles, function (x) file.copy(from=paste(dirName, "/",(stampnum+1),"-",x,sep=""), to=dirERROR ))}
if(debugging=="stamplog"){
logfiles <- file.path(outputLoc,logfiles)
stampAndDir(stampDir=dirName, wrongDir=dirERROR, names=logfiles, type="general",errorsign=errorsign,logfiles=logfiles)
} else { if(debugging){
if(is.null(logfilename)){
if(inputLoc==outputLoc){
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep=""), to=paste(dirName,"/", x, sep="")))
} else {
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep="/"), to=paste(dirName,"/", x, sep="")))
}
if(errorsign==1){
lapply( logfiles, function (x) file.copy(from=paste(dirName,"/", x, sep=""), to=dirERROR))
}
} else {
if(inputLoc==outputLoc){#These are very ugly solutions for a string problem: inputLoc: "./", if outputLoc equalent of inputLoc, it ends with "/", the string manipulation can not handle this. The better solution is easy, but I dont have enough time(Roland Hollo's)
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep=""), to=paste(dirName, "/",logfilename,"-",x,sep="")))
} else {
lapply( logfiles, function (x) file.rename(from=paste(outputLoc,x, sep="/"), to=paste(dirName, "/",logfilename,"-",x,sep="")))
}
if(errorsign==1){
lapply( logfiles, function (x) file.copy(from=paste(dirName, "/",logfilename,"-",x,sep=""), to=dirERROR))
}
}
}}