Skip to content

Commit

Permalink
resolve frameserver symlink
Browse files Browse the repository at this point in the history
  • Loading branch information
rectalogic committed Oct 6, 2023
1 parent 945d78d commit ddfd860
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
9 changes: 8 additions & 1 deletion vfxpipe/vfxpipe.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <limits.h>
// Copyright (c) 2022 Andrew Wason. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Expand All @@ -8,6 +9,7 @@
#include <filesystem>
#include <functional>
#include <iostream>
#include <limits.h>
#include <signal.h>
#include <stdio.h>
#include <string>
Expand Down Expand Up @@ -52,7 +54,12 @@ int spawnProcess(int* pipeRead, int* pipeWrite, const std::string& url, std::fun
std::filesystem::path path(info.dli_fname);
path.remove_filename();
path /= "webvfx";
char* const argv[] = { const_cast<char*>(path.c_str()), const_cast<char*>(url.c_str()), nullptr };
char resolvedPath[PATH_MAX];
if (!realpath(path.c_str(), resolvedPath)) {
errorHandler(std::string("vfxpipe realpath '") + path.generic_string() + "' failed: " + strerror(errno));
exit(1);
}
char* const argv[] = { const_cast<char*>(resolvedPath), const_cast<char*>(url.c_str()), nullptr };
if (execv(argv[0], argv) < 0) {
errorHandler(std::string("vfxpipe exec '") + argv[0] + " " + url + "' failed: " + strerror(errno));
exit(1);
Expand Down
9 changes: 7 additions & 2 deletions viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ if(APPLE)
endif()

install(TARGETS webvfx_viewer
RUNTIME DESTINATION
BUNDLE DESTINATION bin
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
)

if(APPLE)
# https://stackoverflow.com/questions/66550128/create-symlinks-to-libraries-in-different-folder-during-installation-with-cmake
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink \"\${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}/webvfx\" \"\$<TARGET_BUNDLE_CONTENT_DIR:webvfx_viewer>/MacOS/webvfx\")")
endif()
14 changes: 9 additions & 5 deletions viewer/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Viewer::Viewer()
sizeLabel = new QLabel(statusBar());
statusBar()->addPermanentWidget(sizeLabel);

setContentUIEnabled(false);
setContentUIEnabled(true); // XXX

handleResize();
}
Expand Down Expand Up @@ -166,9 +166,13 @@ void Viewer::createContent(const QString& fileName)

QUrlQuery query;
for (int row = 0; row < parametersTable->rowCount(); row++) {
query.addQueryItem(
QUrl::toPercentEncoding(parametersTable->item(row, 0)->text()),
QUrl::toPercentEncoding(parametersTable->item(row, 1)->text()));
auto name = parametersTable->item(row, 0);
auto value = parametersTable->item(row, 1);
if (name && value) {
query.addQueryItem(
QUrl::toPercentEncoding(name->text()),
QUrl::toPercentEncoding(value->text()));
}
}
QUrl qmlUrl(QUrl::fromLocalFile(QFileInfo(fileName).absoluteFilePath()));
qmlUrl.setQuery(query);
Expand All @@ -187,7 +191,7 @@ void Viewer::createContent(const QString& fileName)

logTextEdit->clear();

setContentUIEnabled(false); // XXX need UI enabled all the time now?
setContentUIEnabled(true); // XXX need UI enabled all the time now?

setupImages(scrollArea->widget()->size());
renderContent();
Expand Down

0 comments on commit ddfd860

Please sign in to comment.