From ddfd86015c03c2756c78e080104f9ea08880b8d8 Mon Sep 17 00:00:00 2001 From: Andrew Wason Date: Fri, 6 Oct 2023 12:08:00 -0400 Subject: [PATCH] resolve frameserver symlink --- vfxpipe/vfxpipe.cpp | 9 ++++++++- viewer/CMakeLists.txt | 9 +++++++-- viewer/viewer.cpp | 14 +++++++++----- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/vfxpipe/vfxpipe.cpp b/vfxpipe/vfxpipe.cpp index e1feb77..a2a526b 100644 --- a/vfxpipe/vfxpipe.cpp +++ b/vfxpipe/vfxpipe.cpp @@ -1,3 +1,4 @@ +#include // 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. @@ -8,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -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(path.c_str()), const_cast(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(resolvedPath), const_cast(url.c_str()), nullptr }; if (execv(argv[0], argv) < 0) { errorHandler(std::string("vfxpipe exec '") + argv[0] + " " + url + "' failed: " + strerror(errno)); exit(1); diff --git a/viewer/CMakeLists.txt b/viewer/CMakeLists.txt index 3afe9ce..2cb535c 100644 --- a/viewer/CMakeLists.txt +++ b/viewer/CMakeLists.txt @@ -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\" \"\$/MacOS/webvfx\")") +endif() \ No newline at end of file diff --git a/viewer/viewer.cpp b/viewer/viewer.cpp index bc37197..de9abad 100644 --- a/viewer/viewer.cpp +++ b/viewer/viewer.cpp @@ -45,7 +45,7 @@ Viewer::Viewer() sizeLabel = new QLabel(statusBar()); statusBar()->addPermanentWidget(sizeLabel); - setContentUIEnabled(false); + setContentUIEnabled(true); // XXX handleResize(); } @@ -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); @@ -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();