Документ взят из кэша поисковой машины. Адрес оригинального документа : http://kodomo.fbb.msu.ru/hg/allpy/rev/42b0ec11ae50
Дата изменения: Unknown
Дата индексирования: Tue Oct 2 00:43:38 2012
Кодировка:
allpy: 42b0ec11ae50

allpy

changeset 456:42b0ec11ae50

Removed mktemp_string in favour of one-time mkdtemp invocation
author Daniil Alexeyevsky <dendik@kodomo.fbb.msu.ru>
date Wed, 16 Feb 2011 21:26:54 +0300
parents e7a19d546998
children ffeb89f0df74
files blocks3d/wt/blocks3d-wt-widget.C blocks3d/wt/mktemp_string.C blocks3d/wt/mktemp_string.h
diffstat 3 files changed, 8 insertions(+), 28 deletions(-) [+]
line diff
     1.1 --- a/blocks3d/wt/blocks3d-wt-widget.C	Wed Feb 16 20:33:46 2011 +0300
     1.2 +++ b/blocks3d/wt/blocks3d-wt-widget.C	Wed Feb 16 21:26:54 2011 +0300
     1.3 @@ -1,7 +1,6 @@
     1.4  
     1.5  #include "config.h"
     1.6  #include "blocks3d-wt-widget.h"
     1.7 -#include "mktemp_string.h"
     1.8  
     1.9  #include <Wt/WText>
    1.10  #include <Wt/WBreak>
    1.11 @@ -210,11 +209,13 @@
    1.12  		return;
    1.13  	}
    1.14  	
    1.15 -	tempfile_alignment = mktemp_string(Malakite::temp_mkstemp_path);
    1.16 -	tempfile_conformity = mktemp_string(Malakite::temp_mkstemp_path);
    1.17 -	tempfile_html = mktemp_string(Malakite::temp_mkstemp_path);
    1.18 -	tempfile_check = mktemp_string(Malakite::temp_mkstemp_path);
    1.19 -	tempfile_sh = mktemp_string(Malakite::temp_mkstemp_path);
    1.20 +	char * tmpdir = strdup(Malakite::temp_mkstemp_path);
    1.21 +	mkdtemp(tmpdir);
    1.22 +	tempfile_alignment = std::string(tmpdir) + "/alignment.fasta";
    1.23 +	tempfile_conformity = std::string(tmpdir) + "/conformity";
    1.24 +	tempfile_html = std::string(tmpdir) + "/html";
    1.25 +	tempfile_check = std::string(tmpdir) + "/check";
    1.26 +	tempfile_sh = std::string(tmpdir) + "/run.sh";
    1.27  	
    1.28  	std::ofstream alignment_file;
    1.29  	alignment_file.open(tempfile_alignment.c_str());
    1.30 @@ -269,6 +270,7 @@
    1.31  	go_button->hide();
    1.32  	
    1.33  	current_taks.push_back(tempfile_check);
    1.34 +	free(tmpdir);
    1.35  }
    1.36  
    1.37  void Blocks3DWidget::timeout()
     2.1 --- a/blocks3d/wt/mktemp_string.C	Wed Feb 16 20:33:46 2011 +0300
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,14 +0,0 @@
     2.4 -
     2.5 -#include "mktemp_string.h"
     2.6 -#include <string.h>
     2.7 -#include <cstdlib>
     2.8 -
     2.9 -std::string mktemp_string(const char* templ)
    2.10 -{
    2.11 -	char* tmpname = strdup(templ);
    2.12 -	mktemp(tmpname);
    2.13 -	std::string r = std::string(tmpname);
    2.14 -	delete tmpname;
    2.15 -	return r;
    2.16 -}
    2.17 -
     3.1 --- a/blocks3d/wt/mktemp_string.h	Wed Feb 16 20:33:46 2011 +0300
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,8 +0,0 @@
     3.4 -#ifndef MKTEMP_STRING_H_
     3.5 -#define MKTEMP_STRING_H_
     3.6 -
     3.7 -#include <string>
     3.8 -
     3.9 -std::string mktemp_string(const char* templ);
    3.10 -
    3.11 -#endif // MKTEMP_STRING_H_