From cd628f030c78bb6a2451b192babec83731f2ef9b Mon Sep 17 00:00:00 2001 From: satoshi okami Date: Fri, 1 Jun 2012 21:44:00 +0900 Subject: [PATCH] delete BufferStream::setPath() and can save sc file with your favorite name --- src/renderer/RenderOption.h | 14 ++++++++++++++ src/utils/BufferStream.cpp | 17 +++++------------ src/utils/BufferStream.h | 19 ++++--------------- 3 files changed, 23 insertions(+), 27 deletions(-) create mode 100644 src/renderer/RenderOption.h diff --git a/src/renderer/RenderOption.h b/src/renderer/RenderOption.h new file mode 100644 index 0000000..0c5e4f0 --- /dev/null +++ b/src/renderer/RenderOption.h @@ -0,0 +1,14 @@ +// +// SFRenderOption.h +// emptyExample +// +// Created by Okami Satoshi on 12/06/01. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#ifndef emptyExample_SFRenderOption_h +#define emptyExample_SFRenderOption_h + + + +#endif diff --git a/src/utils/BufferStream.cpp b/src/utils/BufferStream.cpp index 2e79450..220c7f7 100644 --- a/src/utils/BufferStream.cpp +++ b/src/utils/BufferStream.cpp @@ -19,17 +19,17 @@ float BufferStream::omit(float v) void BufferStream::clear() { - if (remove(filePath.c_str()) != 0) - { - //cout << "[WARNING] sc file not found " << filePath.c_str() << endl; + if (remove(filePath.c_str()) != 0) { return; } cout << "[INFO] delete sc file" << endl; } -void BufferStream::save() +void BufferStream::save(string name) { + filePath = getBinDir() + '/' + name; + FILE *fp = fopen(filePath.c_str(), "w"); if (fp == NULL) @@ -41,19 +41,12 @@ void BufferStream::save() fputs(osstream.str().c_str(), fp); fclose(fp); - cout << "[INFO] save " << SUNFLOW_SC << endl; + cout << "[INFO] save " << name << endl; // clear buffer osstream.str(""); } -void BufferStream::setPath(std::string path) -{ - filePath = path; - - cout << "[INFO] change sc file path " << path << endl; -} - std::string BufferStream::getPath() { return filePath; diff --git a/src/utils/BufferStream.h b/src/utils/BufferStream.h index dbe1bc0..4f4f51a 100644 --- a/src/utils/BufferStream.h +++ b/src/utils/BufferStream.h @@ -11,6 +11,7 @@ #include #include +#include "sunflow.h" #include "Constants.h" namespace sf { @@ -31,30 +32,18 @@ namespace sf { public: - BufferStream() - { + BufferStream() { depth = 0; - - char buf[1024]; - getcwd(buf, sizeof(buf)); - std::string ss = buf; - setPath(ss + '/' + SUNFLOW_SC); } - ~BufferStream() - { + ~BufferStream() { depth = 0; - osstream.clear(); - //clear(); } /// output as sc file and clear osstream buffer - void save(); - - // set sc file path - void setPath(std::string path); + void save(string name); // get sc file path std::string getPath();