ProjectLibrary.txt 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. ProjectLibrary
  2. - Save/Load - saves/loads the hierarchy of ResourceEntries
  3. - import(filePath)
  4. - Check if we have an importer that supports the resource with the specified extension
  5. - If we are okay then import the resource, otherwise do nothing and return false
  6. - Check if importer failed and report error if it did, also return false
  7. - move(oldLocation, newLocation)
  8. - Moves the resource from one location to another, first performs the move on the disk, then updates the hierarchy
  9. - Potentially suspends file monitoring since we don't need to detect these changes?
  10. - remove(location, subfolders)
  11. - Removes the resource from the file-system, and the rest is handled by the auto-update system
  12. - monitoring
  13. - Sets up a FileMonitor at the Resources folder, and calls add/move/remove/import whenever changes are reported
  14. ResourceManifest contains absolute file locations. What happens when the project moves?
  15. - When saving ResourceManifest make sure to process all paths and make them relative.
  16. - Then reverse that process on load
  17. What happens when importer fails importing a file?
  18. - This can be one of the lasts steps, but I will likely need to go through all importers manually and set them up so they return proper error codes
  19. and clean up properly on error.
  20. - In fact they should use exceptions but those should be translated to error codes when returned to Importer
  21. - OR just write directly to debug log?
  22. - Probably log and error code, since I will need to inform the outside world that import failed somehow
  23. --------------------
  24. IMPLEMENTATION: First ensure scan and import works. Then work out how to deal with FileMonitor. And finally how to add/remove/move resources from outside.
  25. Don't forget meta files and a way to store import options.
  26. I'll likely need to update ResourceEntry in ProjectLibrary
  27. - Replace UUID field with ResourceMeta class
  28. - Contains UUID and ImportOptions
  29. - Created whenever resource is imported
  30. - Deleted when resource is deleted
  31. Make ProjectLibrary also check for .meta files that have no corresponding file and delete them (With a warning logged)