// Return mime type of a file // Makes use of the Unix file command, thus this function may be slow FXString mimetype(FXString filepath) { FXString cmd ="/usr/bin/file -b -i " + filepath; FILE *filecmd=popen(cmd.text(),"r"); if(!filecmd) { perror("popen"); exit(1); } FXchar text[128]={0}; FXString buf; while(fgets(text,sizeof(text),filecmd)) buf+=text; pclose(filecmd); return buf.rbefore('\n'); }