| 265 | } |
| 266 | |
| 267 | void FileView::OnSubmit(std::string& path){ |
| 268 | std::string absPath; |
| 269 | |
| 270 | if(path[0] == '/'){ // Absolute Path |
| 271 | absPath = path; |
| 272 | } else { // Relative Path |
| 273 | absPath = currentPath + path; |
| 274 | } |
| 275 | |
| 276 | struct stat statResult; |
| 277 | int ret = lstat(absPath.c_str(), &statResult); |
| 278 | |
| 279 | if(ret){ |
| 280 | perror("GUI: FileView: OnSubmit: Stat:"); |
| 281 | char msg[512]; |
| 282 | sprintf(msg, "Error opening file %s (Error Code: %d)", absPath.c_str(), ret); |
| 283 | DisplayMessageBox("Open...", msg, MsgButtonsOK); |
| 284 | return; |
| 285 | } |
| 286 | |
| 287 | if(S_ISDIR(statResult.st_mode)){ |
| 288 | currentPath = absPath; |
| 289 | |
| 290 | Refresh(); |
| 291 | } else if(OnFileOpened) { |
| 292 | OnFileOpened(absPath.c_str(), this); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | void FileView::OnListSubmit(GridItem& item, GridView* list){ |
| 297 | FileView* fv = (FileView*)list->GetParent(); |
no test coverage detected