mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 19:55:07 +02:00
clean up warning and merge with upstream
This commit is contained in:
commit
337fe155b7
15 changed files with 380 additions and 64 deletions
|
@ -269,19 +269,17 @@ void AudioMixer::addStreamToMixForListeningNodeWithStream(AudioMixerClientData&
|
|||
bool forceSilentBlock = true;
|
||||
|
||||
if (!streamToAdd.getLastPopOutput().isNull()) {
|
||||
bool isInjector = dynamic_cast<const InjectedAudioStream*>(&streamToAdd);
|
||||
|
||||
// reptition with fade is enabled, and we do have a valid previous frame to repeat
|
||||
// so we mix the previously-mixed block
|
||||
|
||||
// this is preferable to not mixing it at all to avoid the harsh jump to silence
|
||||
// in an injector, just go silent - the injector has likely ended
|
||||
// in other inputs (microphone, &c.), repeat with fade to avoid the harsh jump to silence
|
||||
|
||||
// we'll repeat the last block until it has a block to mix
|
||||
// and we'll gradually fade that repeated block into silence.
|
||||
|
||||
// calculate its fade factor, which depends on how many times it's already been repeated.
|
||||
|
||||
repeatedFrameFadeFactor = calculateRepeatedFrameFadeFactor(streamToAdd.getConsecutiveNotMixedCount() - 1);
|
||||
if (repeatedFrameFadeFactor > 0.0f) {
|
||||
if (!isInjector && repeatedFrameFadeFactor > 0.0f) {
|
||||
// apply the repeatedFrameFadeFactor to the gain
|
||||
gain *= repeatedFrameFadeFactor;
|
||||
|
||||
|
|
|
@ -355,7 +355,7 @@ Menu::Menu() {
|
|||
//const QString = "1024 MB";
|
||||
//const QString = "2048 MB";
|
||||
|
||||
// Developer > Render > Resolution
|
||||
// Developer > Render > Maximum Texture Memory
|
||||
MenuWrapper* textureMenu = renderOptionsMenu->addMenu(MenuOption::RenderMaxTextureMemory);
|
||||
QActionGroup* textureGroup = new QActionGroup(textureMenu);
|
||||
textureGroup->setExclusive(true);
|
||||
|
@ -383,6 +383,43 @@ Menu::Menu() {
|
|||
gpu::Texture::setAllowedGPUMemoryUsage(newMaxTextureMemory);
|
||||
});
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define MIN_CORES_FOR_INCREMENTAL_TEXTURES 5
|
||||
bool recommendedIncrementalTransfers = (QThread::idealThreadCount() >= MIN_CORES_FOR_INCREMENTAL_TEXTURES);
|
||||
bool recommendedSparseTextures = recommendedIncrementalTransfers;
|
||||
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT]"
|
||||
<< "\n\tidealThreadCount:" << QThread::idealThreadCount()
|
||||
<< "\n\tRECOMMENDED enableSparseTextures:" << recommendedSparseTextures
|
||||
<< "\n\tRECOMMENDED enableIncrementalTextures:" << recommendedIncrementalTransfers;
|
||||
|
||||
gpu::Texture::setEnableIncrementalTextureTransfers(recommendedIncrementalTransfers);
|
||||
gpu::Texture::setEnableSparseTextures(recommendedSparseTextures);
|
||||
|
||||
// Developer > Render > Enable Dynamic Texture Management
|
||||
{
|
||||
auto action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableDynamicTextureManagement, 0, recommendedSparseTextures);
|
||||
connect(action, &QAction::triggered, [&](bool checked) {
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] --- Enable Dynamic Texture Management menu option:" << checked;
|
||||
gpu::Texture::setEnableSparseTextures(checked);
|
||||
});
|
||||
}
|
||||
|
||||
// Developer > Render > Enable Incremental Texture Transfer
|
||||
{
|
||||
auto action = addCheckableActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::EnableIncrementalTextureTransfer, 0, recommendedIncrementalTransfers);
|
||||
connect(action, &QAction::triggered, [&](bool checked) {
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] --- Enable Incremental Texture Transfer menu option:" << checked;
|
||||
gpu::Texture::setEnableIncrementalTextureTransfers(checked);
|
||||
});
|
||||
}
|
||||
|
||||
#else
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] Incremental Texture Transfer and Dynamic Texture Management not supported on this platform.";
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
// Developer > Render > LOD Tools
|
||||
addActionToQMenuAndActionHash(renderOptionsMenu, MenuOption::LodTools, 0, dialogsManager.data(), SLOT(lodTools()));
|
||||
|
||||
|
|
|
@ -98,6 +98,8 @@ namespace MenuOption {
|
|||
const QString EchoLocalAudio = "Echo Local Audio";
|
||||
const QString EchoServerAudio = "Echo Server Audio";
|
||||
const QString EnableCharacterController = "Enable avatar collisions";
|
||||
const QString EnableIncrementalTextureTransfer = "Enable Incremental Texture Transfer";
|
||||
const QString EnableDynamicTextureManagement = "Enable Dynamic Texture Management";
|
||||
const QString EnableInverseKinematics = "Enable Inverse Kinematics";
|
||||
const QString ExpandMyAvatarSimulateTiming = "Expand /myAvatar/simulation";
|
||||
const QString ExpandMyAvatarTiming = "Expand /myAvatar";
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QThread>
|
||||
#include <QtCore/QProcessEnvironment>
|
||||
|
||||
#include "../gl/GLTexelFormat.h"
|
||||
|
||||
|
@ -26,35 +25,6 @@ using namespace gpu;
|
|||
using namespace gpu::gl;
|
||||
using namespace gpu::gl45;
|
||||
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#define MIN_CORES_FOR_INCREMENTAL_TEXTURES 5
|
||||
static const QString DEBUG_FLAG_INCREMENTAL("HIFI_DISABLE_INCREMENTAL_TEXTURES");
|
||||
static const QString DEBUG_FLAG_SPARSE("HIFI_DISABLE_SPARSE_TEXTURES");
|
||||
|
||||
static const bool enableIncrementalTextures = (QThread::idealThreadCount() >= MIN_CORES_FOR_INCREMENTAL_TEXTURES) &&
|
||||
!QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG_INCREMENTAL);
|
||||
|
||||
static const bool enableSparseTextures = enableIncrementalTextures &&
|
||||
!QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG_SPARSE);
|
||||
|
||||
class TextureTransferDebug {
|
||||
public:
|
||||
TextureTransferDebug() {
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT]"
|
||||
<< "\n\tHIFI_DISABLE_INCREMENTAL_TEXTURES:" << QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG_INCREMENTAL)
|
||||
<< "\n\tHIFI_DISABLE_SPARSE_TEXTURES:" << QProcessEnvironment::systemEnvironment().contains(DEBUG_FLAG_SPARSE)
|
||||
<< "\n\tidealThreadCount:" << QThread::idealThreadCount()
|
||||
<< "\n\tenableSparseTextures:" << enableSparseTextures
|
||||
<< "\n\tenableIncrementalTextures:" << enableSparseTextures;
|
||||
}
|
||||
};
|
||||
TextureTransferDebug sparseTextureDebugInfo;
|
||||
#else
|
||||
static bool enableSparseTextures = false;
|
||||
static bool enableIncrementalTextures = false;
|
||||
#endif
|
||||
|
||||
// Allocate 1 MB of buffer space for paged transfers
|
||||
#define DEFAULT_PAGE_BUFFER_SIZE (1024*1024)
|
||||
#define DEFAULT_GL_PIXEL_ALIGNMENT 4
|
||||
|
@ -276,7 +246,7 @@ GLuint GL45Backend::getTextureID(const TexturePointer& texture, bool transfer) {
|
|||
GL45Texture::GL45Texture(const std::weak_ptr<GLBackend>& backend, const Texture& texture, bool transferrable)
|
||||
: GLTexture(backend, texture, allocate(texture), transferrable), _sparseInfo(*this), _transferState(*this) {
|
||||
|
||||
if (enableSparseTextures && _transferrable) {
|
||||
if (_transferrable && Texture::getEnableSparseTextures()) {
|
||||
_sparseInfo.maybeMakeSparse();
|
||||
}
|
||||
}
|
||||
|
@ -375,7 +345,7 @@ void GL45Texture::startTransfer() {
|
|||
}
|
||||
|
||||
bool GL45Texture::continueTransfer() {
|
||||
if (!enableIncrementalTextures) {
|
||||
if (!Texture::getEnableIncrementalTextureTransfers()) {
|
||||
size_t maxFace = GL_TEXTURE_CUBE_MAP == _target ? CUBE_NUM_FACES : 1;
|
||||
for (uint8_t face = 0; face < maxFace; ++face) {
|
||||
for (uint16_t mipLevel = _minMip; mipLevel <= _maxMip; ++mipLevel) {
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
#include "Texture.h"
|
||||
|
||||
#include <glm/gtc/constants.hpp>
|
||||
|
@ -28,6 +31,34 @@ std::atomic<uint32_t> Texture::_textureCPUCount{ 0 };
|
|||
std::atomic<Texture::Size> Texture::_textureCPUMemoryUsage{ 0 };
|
||||
std::atomic<Texture::Size> Texture::_allowedCPUMemoryUsage { 0 };
|
||||
|
||||
std::atomic<bool> Texture::_enableSparseTextures { false };
|
||||
std::atomic<bool> Texture::_enableIncrementalTextureTransfers { false };
|
||||
|
||||
void Texture::setEnableSparseTextures(bool enabled) {
|
||||
#ifdef Q_OS_WIN
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] SETTING - Enable Sparse Textures and Dynamic Texture Management:" << enabled;
|
||||
_enableSparseTextures = enabled;
|
||||
if (!_enableIncrementalTextureTransfers && _enableSparseTextures) {
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] WARNING - Sparse texture management requires incremental texture transfer enabled.";
|
||||
}
|
||||
#else
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] Sparse Textures and Dynamic Texture Management not supported on this platform.";
|
||||
#endif
|
||||
}
|
||||
|
||||
void Texture::setEnableIncrementalTextureTransfers(bool enabled) {
|
||||
#ifdef Q_OS_WIN
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] SETTING - Enable Incremental Texture Transfer:" << enabled;
|
||||
_enableIncrementalTextureTransfers = enabled;
|
||||
if (!_enableIncrementalTextureTransfers && _enableSparseTextures) {
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] WARNING - Sparse texture management requires incremental texture transfer enabled.";
|
||||
}
|
||||
#else
|
||||
qDebug() << "[TEXTURE TRANSFER SUPPORT] Incremental Texture Transfer not supported on this platform.";
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void Texture::updateTextureCPUMemoryUsage(Size prevObjectSize, Size newObjectSize) {
|
||||
if (prevObjectSize == newObjectSize) {
|
||||
return;
|
||||
|
|
|
@ -144,6 +144,9 @@ class Texture : public Resource {
|
|||
static std::atomic<Size> _textureCPUMemoryUsage;
|
||||
static std::atomic<Size> _allowedCPUMemoryUsage;
|
||||
static void updateTextureCPUMemoryUsage(Size prevObjectSize, Size newObjectSize);
|
||||
|
||||
static std::atomic<bool> _enableSparseTextures;
|
||||
static std::atomic<bool> _enableIncrementalTextureTransfers;
|
||||
public:
|
||||
static uint32_t getTextureCPUCount();
|
||||
static Size getTextureCPUMemoryUsage();
|
||||
|
@ -154,6 +157,12 @@ public:
|
|||
static Size getAllowedGPUMemoryUsage();
|
||||
static void setAllowedGPUMemoryUsage(Size size);
|
||||
|
||||
static bool getEnableSparseTextures() { return _enableSparseTextures.load(); }
|
||||
static bool getEnableIncrementalTextureTransfers() { return _enableIncrementalTextureTransfers.load(); }
|
||||
|
||||
static void setEnableSparseTextures(bool enabled);
|
||||
static void setEnableIncrementalTextureTransfers(bool enabled);
|
||||
|
||||
class Usage {
|
||||
public:
|
||||
enum FlagBit {
|
||||
|
|
|
@ -419,7 +419,7 @@ void LightClusters::updateClusters() {
|
|||
|
||||
// Check for overflow
|
||||
if (checkBudget) {
|
||||
if (indexOffset + numLights > maxNumIndices) {
|
||||
if ((indexOffset + numLights) > (uint16_t) maxNumIndices) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
172
server-console/src/content-update.css
Normal file
172
server-console/src/content-update.css
Normal file
|
@ -0,0 +1,172 @@
|
|||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
src: url('vendor/Raleway/Raleway-Regular.ttf');
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
src: url('vendor/Raleway/Raleway-ExtraLight.ttf');
|
||||
font-weight: 200;
|
||||
font-style: normal;
|
||||
}
|
||||
@font-face {
|
||||
font-family: 'Raleway';
|
||||
src: url('vendor/Raleway/Raleway-SemiBold.ttf');
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
|
||||
* {
|
||||
font-family: "Raleway", "Open Sans", Arial, Helvetica, sans-serif;
|
||||
line-height: 130%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
color: #808785;
|
||||
margin: 0 auto;
|
||||
text-align: left;
|
||||
font-size: 13.5pt;
|
||||
-webkit-touch-callout: none; -webkit-user-select: none;
|
||||
cursor: default;
|
||||
overflow: hidden;
|
||||
font-variant-numeric: lining-nums;
|
||||
-moz-font-feature-settings: "lnum";
|
||||
-webkit-font-feature-settings: "lnum";
|
||||
font-feature-settings: "lnum";
|
||||
}
|
||||
|
||||
.selectable {
|
||||
-webkit-touch-callout: text;
|
||||
-webkit-user-select: text;
|
||||
cursor: text;
|
||||
}
|
||||
|
||||
a:link,
|
||||
a:visited,
|
||||
a:hover,
|
||||
a:active {
|
||||
color: #B4B4B4;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color: #2D88A4;
|
||||
}
|
||||
|
||||
.header {
|
||||
width: 95%;
|
||||
left: 2.5%
|
||||
}
|
||||
.colmask {
|
||||
width: 95%;
|
||||
left: 2.5%
|
||||
}
|
||||
.colmid { right: 25% }
|
||||
.colin { right: 25% }
|
||||
.colleft { right: 25% }
|
||||
.col1 {
|
||||
width: 23%;
|
||||
left: 101%
|
||||
}
|
||||
.col2 {
|
||||
width: 23%;
|
||||
left: 53%
|
||||
}
|
||||
.col3 {
|
||||
width: 23%;
|
||||
left: 80%
|
||||
}
|
||||
.col4 {
|
||||
width: 23%;
|
||||
left: 82%
|
||||
}
|
||||
.footer {
|
||||
width: 95%;
|
||||
left: 2.5%
|
||||
}
|
||||
.header {
|
||||
clear: both;
|
||||
float: left;
|
||||
position: relative;
|
||||
border-bottom: #000 1px solid;
|
||||
background-color: #b4d2f7
|
||||
}
|
||||
.colmask {
|
||||
clear: both;
|
||||
float: left;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.colmid {
|
||||
float: left;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.colin {
|
||||
float: left;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.colleft {
|
||||
float: left;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.col1 {
|
||||
padding: 0px 0px 1em 0px;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.col2 {
|
||||
padding: 0px 0px 1em 0px;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.col3 {
|
||||
padding: 0px 0px 1em 0px;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.col4 {
|
||||
padding: 0px 0px 1em 0px;
|
||||
overflow: hidden;
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
.footer {
|
||||
clear: both;
|
||||
float: left;
|
||||
position: relative;
|
||||
padding-top: 8px;
|
||||
border-top: #000 1px solid;
|
||||
|
||||
}
|
||||
.bottom {
|
||||
clear: both;
|
||||
width: 100%;
|
||||
float: left;
|
||||
position: relative;
|
||||
|
||||
}
|
||||
body {
|
||||
border-width: 0px;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
font-size: 90%;
|
||||
width: 100%;
|
||||
min-width: 600px;
|
||||
}
|
53
server-console/src/content-update.html
Normal file
53
server-console/src/content-update.html
Normal file
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Server Backup</title>
|
||||
<script src="content-update.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="content-update.css"></link>
|
||||
</head>
|
||||
<body onload="ready()">
|
||||
<div class="colmask">
|
||||
<h3>We backed up your old Sandbox content, just in case.</h3>
|
||||
<p><b>To restore it, follow these steps:</b>
|
||||
|
||||
<div class="colmid">
|
||||
<div class="colin">
|
||||
|
||||
<div class="colleft">
|
||||
|
||||
<!-- I know the content of the columns are swapped -->
|
||||
<!-- If you manage to fix the CSS, you get to swap it back! -->
|
||||
<div class="col1">
|
||||
<img src="images/step2.jpg" alt="Step 2">
|
||||
<p><b>2.</b> Go to your backup directory:
|
||||
<span id="directory"></span>
|
||||
</div>
|
||||
|
||||
<div class="col2">
|
||||
<img src="images/step1.jpg" alt="Step 1">
|
||||
<p><b>1.</b> Stop your Sandbox server.
|
||||
</div>
|
||||
|
||||
<div class="col3">
|
||||
<img src="images/step3.jpg" alt="Step 3">
|
||||
<p><b>3.</b> Copy the backed up content and paste it into the parent directory.
|
||||
</div>
|
||||
|
||||
<div class="col4">
|
||||
<img src="images/step4.jpg" alt="Step 4">
|
||||
<p><b>4.</b> Restart your Sandbox server.
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
||||
<p>For more information about managing your high Fidelity Sandbox Server, check out our docs: <a href="https://wiki.highfidelity.com/wiki/Sandbox" target="_blank">wiki.highfidelity.com/wiki/Sandbox</a>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
12
server-console/src/content-update.js
Normal file
12
server-console/src/content-update.js
Normal file
|
@ -0,0 +1,12 @@
|
|||
function ready() {
|
||||
console.log("Ready");
|
||||
|
||||
const electron = require('electron');
|
||||
window.$ = require('./vendor/jquery/jquery-2.1.4.min.js');
|
||||
|
||||
electron.ipcRenderer.on('update', function(event, message) {
|
||||
$('#directory').html(message);
|
||||
});
|
||||
|
||||
electron.ipcRenderer.send('ready');
|
||||
}
|
BIN
server-console/src/images/step1.jpg
Normal file
BIN
server-console/src/images/step1.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
server-console/src/images/step2.jpg
Normal file
BIN
server-console/src/images/step2.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.3 KiB |
BIN
server-console/src/images/step3.jpg
Normal file
BIN
server-console/src/images/step3.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
BIN
server-console/src/images/step4.jpg
Normal file
BIN
server-console/src/images/step4.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 9.8 KiB |
|
@ -408,6 +408,13 @@ var labels = {
|
|||
logWindow.open();
|
||||
}
|
||||
},
|
||||
restoreBackup: {
|
||||
label: 'Restore Backup Instructions',
|
||||
click: function() {
|
||||
var folder = getRootHifiDataDirectory() + "/Server Backup";
|
||||
openBackupInstructions(folder);
|
||||
}
|
||||
},
|
||||
share: {
|
||||
label: 'Share',
|
||||
click: function() {
|
||||
|
@ -443,6 +450,7 @@ function buildMenuArray(serverState) {
|
|||
menuArray.push(labels.stopServer);
|
||||
menuArray.push(labels.settings);
|
||||
menuArray.push(labels.viewLogs);
|
||||
menuArray.push(labels.restoreBackup);
|
||||
menuArray.push(separator);
|
||||
menuArray.push(labels.share);
|
||||
menuArray.push(separator);
|
||||
|
@ -488,27 +496,60 @@ function updateTrayMenu(serverState) {
|
|||
|
||||
const httpStatusPort = 60332;
|
||||
|
||||
function deleteResourceDirectories() {
|
||||
const dsResourceDirectory = getDomainServerClientResourcesDirectory();
|
||||
function backupResourceDirectories(folder) {
|
||||
try {
|
||||
fs.removeSync(dsResourceDirectory);
|
||||
console.log("Deleted directory " + dsResourceDirectory);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
const acResourceDirectory = getAssignmentClientResourcesDirectory();
|
||||
try {
|
||||
fs.removeSync(acResourceDirectory);
|
||||
console.log("Deleted directory " + acResourceDirectory);
|
||||
fs.mkdirSync(folder);
|
||||
console.log("Created directory " + folder);
|
||||
|
||||
var dsBackup = path.join(folder, '/domain-server');
|
||||
var acBackup = path.join(folder, '/assignment-client');
|
||||
|
||||
fs.copySync(getDomainServerClientResourcesDirectory(), dsBackup);
|
||||
fs.copySync(getAssignmentClientResourcesDirectory(), acBackup);
|
||||
|
||||
fs.removeSync(getDomainServerClientResourcesDirectory());
|
||||
fs.removeSync(getAssignmentClientResourcesDirectory());
|
||||
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function deleteResourceDirectoriesAndRestart() {
|
||||
function openBackupInstructions(folder) {
|
||||
// Explain user how to restore server
|
||||
var window = new BrowserWindow({
|
||||
icon: appIcon,
|
||||
width: 800,
|
||||
height: 520,
|
||||
});
|
||||
window.loadURL('file://' + __dirname + '/content-update.html');
|
||||
if (!debug) {
|
||||
window.setMenu(null);
|
||||
}
|
||||
window.show();
|
||||
|
||||
electron.ipcMain.on('ready', function() {
|
||||
console.log("got ready");
|
||||
window.webContents.send('update', folder);
|
||||
});
|
||||
}
|
||||
function backupResourceDirectoriesAndRestart() {
|
||||
homeServer.stop();
|
||||
deleteResourceDirectories();
|
||||
maybeInstallDefaultContentSet(onContentLoaded);
|
||||
|
||||
var folder = getRootHifiDataDirectory() + "/Server Backup - " + Date.now();
|
||||
if (backupResourceDirectories(folder)) {
|
||||
maybeInstallDefaultContentSet(onContentLoaded);
|
||||
openBackupInstructions(folder);
|
||||
} else {
|
||||
dialog.showMessageBox({
|
||||
type: 'warning',
|
||||
buttons: ['Ok'],
|
||||
title: 'Update Error',
|
||||
message: 'There was an error updating the content, aborting.'
|
||||
}, function() {});
|
||||
}
|
||||
}
|
||||
|
||||
function checkNewContent() {
|
||||
|
@ -537,16 +578,7 @@ function checkNewContent() {
|
|||
message: 'A newer version of the home content set is available.\nDo you wish to update?'
|
||||
}, function(idx) {
|
||||
if (idx === 0) {
|
||||
dialog.showMessageBox({
|
||||
type: 'question',
|
||||
buttons: ['Yes', 'No'],
|
||||
title: 'Are you sure?',
|
||||
message: 'This action will delete your current sandbox content.\nDo you wish to continue?'
|
||||
}, function(idx) {
|
||||
if (idx === 0 && homeServer) {
|
||||
deleteResourceDirectoriesAndRestart();
|
||||
}
|
||||
});
|
||||
backupResourceDirectoriesAndRestart();
|
||||
} else {
|
||||
// They don't want to update, mark content set as current
|
||||
userConfig.set('homeContentLastModified', new Date());
|
||||
|
|
Loading…
Reference in a new issue