Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/wasm remote 2 #1288

Open
wants to merge 20 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/plugins/score-plugin-remotecontrol/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ set(SRCS
"${CMAKE_CURRENT_SOURCE_DIR}/score_plugin_remotecontrol.cpp"
)

file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/RemoteControl/build-wasm/ DESTINATION ${CMAKE_BINARY_DIR}/src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/)
#file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/RemoteControl/build-wasm/ DESTINATION ${CMAKE_BINARY_DIR}/src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/)

add_library(${PROJECT_NAME} ${SRCS} ${HDRS} ${QRCS})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ ApplicationPlugin::ApplicationPlugin(const score::GUIApplicationContext& app)
{
}

ApplicationPlugin::~ApplicationPlugin()
{
std::remove((m_server.m_buildWasmPath + "remote.html").c_str());
std::rename((m_server.m_buildWasmPath + "remote.html~").c_str(), (m_server.m_buildWasmPath + "remote.html").c_str());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... what is happening here ?

}

void ApplicationPlugin::on_createdDocument(score::Document& doc)
{
doc.model().addPluginModel(new DocumentPlugin{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ApplicationPlugin final : public score::GUIApplicationPlugin
{
public:
ApplicationPlugin(const score::GUIApplicationContext& app);
~ApplicationPlugin();

protected:
void on_createdDocument(score::Document& doc) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,11 @@ HttpServer::do_session(
void
HttpServer::set_ip_address(std::string address)
{
QDebug << "buildWasmPath :" << buildWasmPath;
std::rename(buildWasmPath + "remote.html", buildWasmPath + "remote.html~");
qDebug() << "buildWasmPath :" << QString::fromStdString(m_buildWasmPath);
std::rename((m_buildWasmPath + "remote.html").c_str(), (m_buildWasmPath + "remote.html~").c_str());

std::ifstream old_file(buildWasmPath + "remote.html~");
std::ofstream new_file(buildWasmPath + "remote.html");
std::ifstream old_file(m_buildWasmPath + "remote.html~");
std::ofstream new_file(m_buildWasmPath + "remote.html");

std::string addr = "\"" + address + "\"";

Expand Down Expand Up @@ -289,11 +289,10 @@ HttpServer::open_server()
{
auto const address2 = net::ip::make_address("0.0.0.0");
auto const port = static_cast<unsigned short>(std::atoi("8080"));
// auto const m_docRoot = std::make_shared<std::string>("./src/plugins/score-plugin-remotecontrol/CMakeFiles/score_plugin_remotecontrol.dir/RemoteControl/build-wasm/");
std::string packagesPath = score::AppContext().settings<Library::Settings::Model>().getPackagesPath().toUtf8().constData();
QDebug << "packagesPath :" << packagesPath;
buildWasmPath = packagesPath + "/build-wasm/";
auto const m_docRoot = std::make_shared<std::string>(buildWasmPath);
std::string packagesPath = score::AppContext().settings<Library::Settings::Model>().getPackagesPath().toStdString();
qDebug() << "packagesPath :" << QString::fromStdString(packagesPath);
m_buildWasmPath = packagesPath + "/build-wasm/";
auto const m_docRoot = std::make_shared<std::string>(m_buildWasmPath);

bool is_ip_address_set = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,6 @@ class HttpServer

std::thread m_serverThread;
int m_listenSocket{};
std::string buildWasmPath;
std::string m_buildWasmPath;
};
}