mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-20 09:41:19 -05:00
Start work on TorrentSynchronization
This commit is contained in:
@@ -406,22 +406,8 @@ void OpenSpaceEngine::create(int argc, char** argv,
|
||||
sgctArguments.insert(sgctArguments.begin() + 2, absPath(sgctConfigurationPath));
|
||||
|
||||
// Set up asset loader
|
||||
ResourceSynchronizationOptions syncOptions;
|
||||
syncOptions.synchronizationRoot = absPath("${SYNC}");
|
||||
if (_engine->_configurationManager->hasKey(
|
||||
ConfigurationManager::KeyHttpSynchronizationRepositories))
|
||||
{
|
||||
ghoul::Dictionary dictionary = _engine->_configurationManager->value<ghoul::Dictionary>(
|
||||
ConfigurationManager::KeyHttpSynchronizationRepositories
|
||||
);
|
||||
for (std::string key : dictionary.keys()) {
|
||||
syncOptions.httpSynchronizationRepositories.push_back(
|
||||
dictionary.value<std::string>(key)
|
||||
);
|
||||
}
|
||||
}
|
||||
_engine->_assetManager = std::make_unique<AssetManager>(
|
||||
std::make_unique<AssetLoader>(*OsEng.scriptEngine().luaState(), "${ASSETS}", syncOptions),
|
||||
std::make_unique<AssetLoader>(*OsEng.scriptEngine().luaState(), "${ASSETS}"),
|
||||
std::make_unique<AssetSynchronizer>(OsEng._resourceSynchronizer.get())
|
||||
);
|
||||
//_engine->_globalPropertyNamespace->addPropertySubOwner(_engine->_assetLoader->rootAsset());
|
||||
|
||||
@@ -57,19 +57,6 @@ std::string Asset::resolveLocalResource(std::string resourceName) {
|
||||
resourceName;
|
||||
}
|
||||
|
||||
std::string Asset::syncDirectory() const {
|
||||
std::string currentAssetDirectory = assetDirectory();
|
||||
std::string rootAssetDirectory = loader()->assetRootDirectory();
|
||||
std::string relativePath = FileSys.relativePath(currentAssetDirectory,
|
||||
rootAssetDirectory);
|
||||
|
||||
return loader()->syncRootDirectory() +
|
||||
ghoul::filesystem::FileSystem::PathSeparator +
|
||||
relativePath +
|
||||
ghoul::filesystem::FileSystem::PathSeparator +
|
||||
ghoul::filesystem::File(_assetPath).baseName();
|
||||
}
|
||||
|
||||
Asset::ReadyState Asset::readyState() const {
|
||||
return _readyState;
|
||||
}
|
||||
|
||||
@@ -71,13 +71,11 @@ namespace openspace {
|
||||
|
||||
AssetLoader::AssetLoader(
|
||||
ghoul::lua::LuaState& luaState,
|
||||
std::string assetRootDirectory,
|
||||
ResourceSynchronizationOptions syncOptions
|
||||
std::string assetRootDirectory
|
||||
)
|
||||
: _luaState(&luaState)
|
||||
, _rootAsset(std::make_shared<Asset>(this))
|
||||
, _assetRootDirectory(assetRootDirectory)
|
||||
, _synchronizationOptions(std::move(syncOptions))
|
||||
{
|
||||
pushAsset(_rootAsset);
|
||||
|
||||
@@ -226,10 +224,6 @@ std::shared_ptr<Asset> AssetLoader::rootAsset() const {
|
||||
return _rootAsset;
|
||||
}
|
||||
|
||||
const std::string& AssetLoader::syncRootDirectory() {
|
||||
return _synchronizationOptions.synchronizationRoot;
|
||||
}
|
||||
|
||||
const std::string & AssetLoader::assetRootDirectory()
|
||||
{
|
||||
return _assetRootDirectory;
|
||||
@@ -304,7 +298,6 @@ int AssetLoader::syncedResourceLua(Asset* asset) {
|
||||
std::shared_ptr<ResourceSynchronization> sync =
|
||||
ResourceSynchronization::createFromDictionary(d);
|
||||
|
||||
sync->setSynchronizationOptions(_synchronizationOptions);
|
||||
std::string absolutePath = sync->directory();
|
||||
|
||||
asset->addSynchronization(sync);
|
||||
|
||||
@@ -23,6 +23,9 @@
|
||||
****************************************************************************************/
|
||||
|
||||
#include <openspace/util/resourcesynchronization.h>
|
||||
#include <openspace/engine/moduleengine.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <modules/sync/syncmodule.h>
|
||||
|
||||
#include <openspace/util/factorymanager.h>
|
||||
#include <openspace/documentation/documentationengine.h>
|
||||
@@ -89,6 +92,7 @@ std::unique_ptr<ResourceSynchronization> ResourceSynchronization::createFromDict
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const SyncModule* syncModule = OsEng.moduleEngine().module<SyncModule>();
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -115,13 +119,6 @@ void ResourceSynchronization::updateProgress(float t) {
|
||||
_progress = std::min(1.0f, std::max(t, 0.0f));
|
||||
}
|
||||
|
||||
void ResourceSynchronization::setSynchronizationOptions(
|
||||
openspace::ResourceSynchronizationOptions opt)
|
||||
{
|
||||
_synchronizationOptions = std::move(opt);
|
||||
}
|
||||
|
||||
|
||||
// SynchronizationJob methods
|
||||
|
||||
SynchronizationJob::SynchronizationJob(ResourceSynchronization* synchronization) {
|
||||
|
||||
Reference in New Issue
Block a user