git-svn-id: svn://db.shs.com.ru/pip@225 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5

This commit is contained in:
2016-08-16 21:22:07 +00:00
parent 590a3be4d4
commit 2a7e45baff
5 changed files with 37 additions and 19 deletions

View File

@@ -77,6 +77,9 @@ bool PIBinaryLog::openDevice() {
piCoutObj << "Error: ReadWrite mode not supported, use WriteOnly or ReadOnly";
return false;
}
if (path().isEmpty() && mode_ == WriteOnly) {
setPath(getLogfilePath());
}
if (!file.open(path(), mode_)) {
piCoutObj << "Error: Can't open file" << path();
return false;
@@ -177,8 +180,7 @@ bool PIBinaryLog::threadedRead(uchar *readed, int size) {
}
PIString PIBinaryLog::createNewFile() {
if (!file.close()) return PIString();
PIString PIBinaryLog::getLogfilePath() const {
PIDir dir(logDir());
dir.setDir(dir.absolutePath());
if (!dir.isExists()) {
@@ -192,6 +194,12 @@ PIString PIBinaryLog::createNewFile() {
cnpath = npath + "_" + PIString::fromNumber(i) + ".binlog";
i++;
}
return cnpath;
}
PIString PIBinaryLog::createNewFile() {
if (!file.close()) return PIString();
PIString cnpath = getLogfilePath();
if (open(cnpath, PIIODevice::WriteOnly)) {
newFile(file.path());
return file.path();