some PIFile functionality
PIBinaryLog::close fix
This commit is contained in:
@@ -156,7 +156,7 @@ bool PIBinaryLog::openDevice() {
|
||||
|
||||
|
||||
bool PIBinaryLog::closeDevice() {
|
||||
stopThreadedRead();
|
||||
stopAndWait();
|
||||
pausemutex.unlock();
|
||||
logmutex.unlock();
|
||||
moveIndex(-1);
|
||||
|
||||
@@ -160,6 +160,16 @@ PIDir & PIDir::cleanPath() {
|
||||
PIString PIDir::relative(const PIString & path) const {
|
||||
PIDir td(path);
|
||||
PIStringList dl(absolutePath().split(separator)), pl(td.absolutePath().split(separator)), rl;
|
||||
auto checkPath = [](PIStringList & path) {
|
||||
if (path.isEmpty()) return;
|
||||
if (path[0].size() >= 2) {
|
||||
if (path[0][0].isAlpha() && path[0][1] == ':') {
|
||||
path[0][0] = path[0][0].toUpper();
|
||||
}
|
||||
}
|
||||
};
|
||||
checkPath(dl);
|
||||
checkPath(pl);
|
||||
// piCout << pl << "rel to" << dl;
|
||||
while (!dl.isEmpty() && !pl.isEmpty()) {
|
||||
if (dl.front() != pl.front()) break;
|
||||
|
||||
@@ -153,6 +153,16 @@ PIString PIFile::FileInfo::dir() const {
|
||||
}
|
||||
|
||||
|
||||
bool PIFile::FileInfo::isAbsolute() const {
|
||||
if (path.isEmpty()) return false;
|
||||
if (path[0] == '/') return true;
|
||||
if (path.size() >= 2) {
|
||||
if (path[0].isAlpha() && path[1] == ':') return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
PIFile::PIFile(): PIIODevice() {}
|
||||
|
||||
|
||||
|
||||
@@ -179,6 +179,10 @@ public:
|
||||
//! \~english Returns if Hidden flag set
|
||||
//! \~russian Возвращает установлен ли флаг Hidden
|
||||
bool isHidden() const { return flags[Hidden]; }
|
||||
|
||||
//! \~english Returns if path is absolute
|
||||
//! \~russian Возвращает абсолютный ли путь
|
||||
bool isAbsolute() const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
const char PIValueTree::Attribute::hidden [] = "hidden" ;
|
||||
const char PIValueTree::Attribute::readOnly [] = "readOnly" ;
|
||||
const char PIValueTree::Attribute::isLabel [] = "label" ;
|
||||
const char PIValueTree::Attribute::grouping [] = "grouping" ;
|
||||
|
||||
const char PIValueTree::Attribute::arrayType [] = "arrayType" ;
|
||||
const char PIValueTree::Attribute::arrayMinCount[] = "arrayMinCount";
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
static const char hidden [];
|
||||
static const char readOnly [];
|
||||
static const char isLabel [];
|
||||
static const char grouping [];
|
||||
|
||||
static const char arrayType [];
|
||||
static const char arrayMinCount[];
|
||||
|
||||
Reference in New Issue
Block a user