selectFolder()

Input / Files

Description

Opens a folder chooser dialog. Returns the selected folder path.

Syntax

std::string selectFolder(std::string prompt)

Parameters

NameTypeDescription
promptstd::stringdialog message

Returns

std::string

Related

Under the Hood

From Processing.h:

static std::string selectFolder(const std::string& prompt="");

Under the Hood

From Processing.cpp:

std::string PApplet::selectFolder(const std::string& prompt){ std::string cmd="zenity --file-selection --directory --title=\""+prompt+"\" 2>/dev/null"; FILE* p=popen(cmd.c_str(),"r"); if(!p)return ""; char buf[4096]=""; fgets(buf,sizeof(buf),p); pclose(p); std::string r(buf); if(!r.empty()&&r.back()=='\n')r.pop_back(); return r; }