mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-26 14:58:51 -06:00
Fixes to allow using temp directory for profile-to-asset conversion
This commit is contained in:
@@ -308,7 +308,7 @@ function generateAsset(T, fileOut)
|
||||
end
|
||||
|
||||
--Asset section
|
||||
AssetStr = AssetStr.."asset.require('./base');\n"
|
||||
AssetStr = AssetStr.."asset.require('base');\n"
|
||||
AssetStr = AssetStr.."local assetHelper = asset.require('util/asset_helper')\n"
|
||||
AssetStr = AssetStr.."local propertyHelper = asset.require('util/property_helper')\n"
|
||||
AssetStr = AssetStr.."local sceneHelper = asset.require('util/scene_helper')\n"
|
||||
@@ -467,8 +467,7 @@ parsingSections = {
|
||||
profileFilename = openspace.profile.getFilename()
|
||||
profilePath = openspace.profile.getPath()
|
||||
|
||||
profileIn = profilePath.."\\"..profileFilename
|
||||
assetOut = profilePath.."\\"..profileFilename:match("^.+%.").."scene"
|
||||
assetOut = profilePath..".scene"
|
||||
|
||||
local resultTable = parseProfile(profileIn)
|
||||
local resultTable = parseProfile(profilePath)
|
||||
generateAsset(resultTable, assetOut)
|
||||
|
||||
@@ -362,7 +362,7 @@ Configuration loadConfigurationFromFile(const std::string& filename) {
|
||||
// created with that name, and also because the profile name will override
|
||||
// an asset name if both are provided.
|
||||
if (!result.profile.empty()) {
|
||||
result.asset = result.profile;
|
||||
result.asset = "../../temp/" + result.profile;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -301,18 +301,24 @@ void OpenSpaceEngine::initialize() {
|
||||
global::configuration.profile));
|
||||
ghoul::lua::LuaState lState;
|
||||
|
||||
// Get path where .scene files reside. Need to add extra escape slashes to
|
||||
// accomodate lua parser.
|
||||
// Generate path to temp dir where output .scene file will reside.
|
||||
// Needs to handle either windows (which seems to require double back-slashes)
|
||||
// or unix path slashes.
|
||||
std::string outputScenePath = absPath("${TEMPORARY}");
|
||||
std::string search = "\\";
|
||||
std::string replace = "\\\\";
|
||||
for (std::string::size_type i = outputScenePath.find(search);
|
||||
i != std::string::npos;
|
||||
i = outputScenePath.find(search, i))
|
||||
{
|
||||
outputScenePath.replace(i, search.length(), replace);
|
||||
i += replace.length();
|
||||
const std::string search = "\\";
|
||||
const std::string replace = "\\\\";
|
||||
if (outputScenePath.find(search) != std::string::npos) {
|
||||
size_t start_pos = 0;
|
||||
while((start_pos = outputScenePath.find(search, start_pos)) != std::string::npos) {
|
||||
outputScenePath.replace(start_pos, search.length(), replace);
|
||||
start_pos += replace.length();
|
||||
}
|
||||
outputScenePath.append(replace);
|
||||
}
|
||||
else {
|
||||
outputScenePath.append("/");
|
||||
}
|
||||
outputScenePath.append(global::configuration.profile);
|
||||
|
||||
std::string setProfileFilenameInLuaState = fmt::format(R"(
|
||||
openspace = {{}}
|
||||
|
||||
Reference in New Issue
Block a user