29.04.2014 - Version 0.4.0_prealpha. PICodeParser, namespace PICodeInfo, new tool "pip_cmg" in dir "code_model_generator". New feature in PIIODevice - "createFromFullPath", all parameters of all I/O devices now works with PIObjects`s properties.
This commit is contained in:
13
pifile.cpp
13
pifile.cpp
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
PIP - Platform Independent Primitives
|
||||
File
|
||||
Copyright (C) 2013 Ivan Pelipenko peri4ko@gmail.com
|
||||
Copyright (C) 2014 Ivan Pelipenko peri4ko@gmail.com
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
@@ -40,12 +40,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
REGISTER_DEVICE(PIFile);
|
||||
|
||||
|
||||
bool PIFile::openDevice() {
|
||||
close();
|
||||
if (path_.isEmpty()) return false;
|
||||
if (path().isEmpty()) return false;
|
||||
//piCout << "fopen " << path_.data() << ": " << strType(mode_).data() << fd;
|
||||
fd = fopen(path_.data(), strType(mode_).data());
|
||||
fd = fopen(path().data(), strType(mode_).data());
|
||||
opened_ = (fd != 0);
|
||||
#ifndef WINDOWS
|
||||
if (opened_) fcntl(fileno(fd), F_SETFL, O_NONBLOCK);
|
||||
@@ -144,3 +146,8 @@ bool PIFile::isExists(const PIString & path) {
|
||||
if (ok) fclose(f);
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
void PIFile::configureFromFullPath(const PIString & full_path) {
|
||||
setPath(full_path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user