Ticket #1687: hotloading.patch
File hotloading.patch, 1.5 KB (added by , 11 years ago) |
---|
-
source/ps/Filesystem.cpp
73 73 74 74 std::vector<DirWatchNotification> notifications; 75 75 RETURN_STATUS_IF_ERR(dir_watch_Poll(notifications)); 76 Status status = INFO::OK; 76 77 for(size_t i = 0; i < notifications.size(); i++) 77 78 { 78 79 if(!CanIgnore(notifications[i])) 79 80 { 81 // TODO: logging? 82 #define CONTINUE_IF_ERR(expression)\ 83 status = (expression);\ 84 if (status < 0)\ 85 continue 86 80 87 VfsPath pathname; 81 RETURN_STATUS_IF_ERR(g_VFS->GetVirtualPath(notifications[i].Pathname(), pathname)); 82 RETURN_STATUS_IF_ERR(g_VFS->RemoveFile(pathname)); 83 RETURN_STATUS_IF_ERR(g_VFS->RepopulateDirectory(pathname.Parent()/"")); 88 CONTINUE_IF_ERR(g_VFS->GetVirtualPath(notifications[i].Pathname(), pathname)); 89 // Handle additions of new files too 90 status = g_VFS->RemoveFile(pathname); 91 if (status < 0 && status != ERR::VFS_FILE_NOT_FOUND) 92 continue; 93 94 CONTINUE_IF_ERR(g_VFS->RepopulateDirectory(pathname.Parent()/"")); 84 95 85 96 // Tell each hotloadable system about this file change: 86 97 87 RETURN_STATUS_IF_ERR(g_GUI->ReloadChangedFiles(pathname));98 g_GUI->ReloadChangedFiles(pathname); 88 99 89 100 for (size_t j = 0; j < g_ReloadFuncs.size(); ++j) 90 101 g_ReloadFuncs[j].first(g_ReloadFuncs[j].second, pathname); 91 102 92 RETURN_STATUS_IF_ERR(h_reload(g_VFS, pathname)); 103 h_reload(g_VFS, pathname); 104 105 #undef CONTINUE_IF_ERR 93 106 } 94 107 } 95 108 return INFO::OK;