v1.4.4
This commit is contained in:
commit
9c94d113d3
10260 changed files with 1237388 additions and 0 deletions
41
source/base/StarDirectoryAssetSource.hpp
Normal file
41
source/base/StarDirectoryAssetSource.hpp
Normal file
|
@ -0,0 +1,41 @@
|
|||
#ifndef STAR_DIRECTORY_ASSET_SOURCE_HPP
|
||||
#define STAR_DIRECTORY_ASSET_SOURCE_HPP
|
||||
|
||||
#include "StarAssetSource.hpp"
|
||||
#include "StarString.hpp"
|
||||
|
||||
namespace Star {
|
||||
|
||||
STAR_CLASS(DirectoryAssetSource);
|
||||
|
||||
class DirectoryAssetSource : public AssetSource {
|
||||
public:
|
||||
// Any file that forms an asset path that matches any of the patterns in
|
||||
// 'ignorePatterns' is ignored.
|
||||
DirectoryAssetSource(String const& baseDirectory, StringList const& ignorePatterns = {});
|
||||
|
||||
JsonObject metadata() const override;
|
||||
StringList assetPaths() const override;
|
||||
|
||||
IODevicePtr open(String const& path) override;
|
||||
ByteArray read(String const& path) override;
|
||||
|
||||
// Converts an asset path to the path on the filesystem
|
||||
String toFilesystem(String const& path) const;
|
||||
|
||||
// Update metadata file or add a new one.
|
||||
void setMetadata(JsonObject metadata);
|
||||
|
||||
private:
|
||||
void scanAll(String const& assetDirectory, StringList& output) const;
|
||||
|
||||
String m_baseDirectory;
|
||||
List<String> m_ignorePatterns;
|
||||
Maybe<String> m_metadataFile;
|
||||
JsonObject m_metadata;
|
||||
StringList m_assetPaths;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue