@taprik wrote:
Hi there,
Below is the setup of my application (derived from dirListExemple)
//-------------------------------------------------------------- void ofApp::setup(){ if (dir.doesDirectoryExist("//New-host/bigBacks")) { dir.listDir("//New-host/bigBacks"); //dir.sort(); // in linux the file system doesn't return file lists ordered in alphabetical order //allocate the vector to have as many ofImages as files if( dir.size() ){ images.assign(dir.size(), ofImage()); } // you can now iterate through the files and load them into the ofImage vector for(int i = 0; i < (int)dir.size(); i++){ images[i].loadImage(dir.getPath(i)); } } currentImage = 0; ofBackground(ofColor::white); }
This is the setup of this example. Actually I've only add the doesDirectoryExist function with a path of a share folder on an other computer.
If I test it with a folder that does not exists it raises an unexpected poco exception.
With a path on my computer (that does not exists too) it doesn't raises a poco exception but an error ...
With a valid path on a distant computer it works (of course).I have to change the doesDirectoryExist function to catch this exception.
//------------------------------------------------------------------------------------------------------------ bool ofDirectory::doesDirectoryExist(string dirPath, bool bRelativeToData){ try{ if(bRelativeToData){ dirPath = ofToDataPath(dirPath); } File file(dirPath); return file.exists(); } catch(Poco::Exception & except){ ofLogError("ofDirectory") << "doesDirectoryExist(): couldn't find directory \"" << dirPath << "\": " << except.displayText(); return false; } }
Computer : windows 8.1, VS2012, OF 0.8.4
Cheers
Posts: 1
Participants: 1