diff --git a/doomsday/sdk/libcore/include/de/filesys/directoryfeed.h b/doomsday/sdk/libcore/include/de/filesys/directoryfeed.h index f2205e48a3..1fae0fc061 100644 --- a/doomsday/sdk/libcore/include/de/filesys/directoryfeed.h +++ b/doomsday/sdk/libcore/include/de/filesys/directoryfeed.h @@ -105,6 +105,17 @@ class DENG2_PUBLIC DirectoryFeed : public Feed */ static File::Status fileStatus(NativePath const &nativePath); + /** + * Creates and interprets a single native file and adds it to a folder. The created + * file is not governed by any feed and will not be pruned during folder pruning. + * + * @param nativePath Native path of the source file. + * @param parentFolder Folder where to place the interpreted file. + * + * @return Reference to the interpreted file. + */ + static File &manuallyPopulateSingleFile(NativePath const &nativePath, Folder &parentFolder); + protected: void populateSubFolder(Folder const &folder, String const &entryName); void populateFile(Folder const &folder, String const &entryName, PopulatedFiles &populated); diff --git a/doomsday/sdk/libcore/src/filesys/directoryfeed.cpp b/doomsday/sdk/libcore/src/filesys/directoryfeed.cpp index 7834edf648..31755f6e4c 100644 --- a/doomsday/sdk/libcore/src/filesys/directoryfeed.cpp +++ b/doomsday/sdk/libcore/src/filesys/directoryfeed.cpp @@ -266,3 +266,17 @@ File::Status DirectoryFeed::fileStatus(NativePath const &nativePath) // Get file status information. return File::Status(info.size(), info.lastModified()); } + +File &DirectoryFeed::manuallyPopulateSingleFile(NativePath const &nativePath, + Folder &parentFolder) +{ + File::Status const status = fileStatus(nativePath); + + auto *source = new NativeFile(nativePath.fileName(), nativePath); + source->setStatus(status); + + File *file = FileSystem::get().interpret(source); + parentFolder.add(file); + FileSystem::get().index(*file); + return *file; +}