Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

I want to get all images filepath name in a directory

$
0
0

@bemoregt wrote:

Hi, All.

I want to get all images filepath name in a directory.
and that diretory is got from draginfo of dragEvent.

My code is here:
void ofApp::dragEvent(ofDragInfo dragInfo){

if( dragInfo.files.size() > 0 ){
    img1.load(dragInfo.files[0]);
    img1.setImageType(OF_IMAGE_COLOR);
    
    ofDirectory dir(dragInfo.files[0]);
    dir.allowExt("png");
    dir.listDir();
    // all file
    for(int i = 0; i < dir.size(); i++){
        ofLog() << dir.getPath(i) << endl;
    }
}
ofSetWindowShape(img1.getWidth(), img1.getHeight());

}

But I met this error:
“[ error ] ofDirectory: listDir:() source directory does not exist:”

What’s wrong to me ?

Thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles