[DEBUG] remove open folder

This commit is contained in:
Edouard DUPIN 2013-11-25 21:20:13 +01:00
parent 9c4d936d76
commit b79578b7e1

View File

@ -58,6 +58,10 @@ appl::Buffer* appl::BufferManager::get(const std::string& _fileName, bool _creat
} }
} }
if (_createIfNeeded == true) { if (_createIfNeeded == true) {
if (etk::FSNodeGetType(_fileName) == etk::FSN_FOLDER) {
APPL_INFO("try open a folder : " << _fileName);
return NULL;
}
appl::Buffer* tmp = new appl::Buffer(); appl::Buffer* tmp = new appl::Buffer();
if (tmp == NULL) { if (tmp == NULL) {
APPL_ERROR("Can not allocate the Buffer class : " << _fileName); APPL_ERROR("Can not allocate the Buffer class : " << _fileName);
@ -101,10 +105,13 @@ bool appl::BufferManager::exist(const std::string& _fileName) {
} }
void appl::BufferManager::open(const std::string& _fileName) { void appl::BufferManager::open(const std::string& _fileName) {
if (exist(_fileName) == false) { if (exist(_fileName) == true) {
(void)get(_fileName, true); return;
sendMultiCast(appl::MsgSelectNewFile, _fileName);
} }
if (get(_fileName, true) == NULL) {
return;
}
sendMultiCast(appl::MsgSelectNewFile, _fileName);
} }
void appl::BufferManager::onReceiveMessage(const ewol::EMessage& _msg) { void appl::BufferManager::onReceiveMessage(const ewol::EMessage& _msg) {