Skip to content

Commit

Permalink
Updater
Browse files Browse the repository at this point in the history
  • Loading branch information
qurious-pixel authored Apr 20, 2024
1 parent 6a6945f commit 9d12faa
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions src/gui/CemuUpdateWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,18 +495,15 @@ void CemuUpdateWindow::WorkerThread()
fs::rename(exec, target_exe);
m_restartFile = exec;
#elif BOOST_OS_LINUX
if (std::getenv("APPIMAGE"))
{
std::string target_directory = exePath.parent_path().generic_string();
const auto exec = exePath;
const auto target_exe = fs::path(exePath).replace_extension("AppImage.backup");
const char* appimage_path = std::getenv("APPIMAGE");
const auto target_exe = fs::path(appimage_path).replace_extension("AppImage.backup");
const char* filePath = update_file.c_str();
mode_t permissions = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH;
fs::rename(exec, target_exe);
m_restartFile = exec;
fs::rename(appimage_path, target_exe);
m_restartFile = appimage_path;
chmod(filePath, permissions);
wxCopyFile (wxT("/tmp/cemu_update/Cemu.AppImage"), wxT("/home/ubuntu/Downloads/Cemu.AppImage"));
}
wxString wxAppPath = wxString::FromUTF8(appimage_path);
wxCopyFile (wxT("/tmp/cemu_update/Cemu.AppImage"), wxAppPath);
#endif
#if BOOST_OS_WINDOWS
const auto index = expected_path.wstring().size();
Expand Down Expand Up @@ -595,11 +592,8 @@ void CemuUpdateWindow::OnClose(wxCloseEvent& event)
#elif BOOST_OS_LINUX
if (m_restartRequired && !m_restartFile.empty() && fs::exists(m_restartFile))
{
fs::path exePath = ActiveSettings::GetExecutablePath();
const char* appimage_path = std::getenv("APPIMAGE");
const auto tmppath = fs::temp_directory_path() / L"cemu_update";
std::string target_exe = (exePath);
execlp(target_exe.c_str(), target_exe.c_str(), (char *)NULL);
execlp(appimage_path, appimage_path, (char *)NULL);

exit(0);
}
Expand All @@ -611,7 +605,7 @@ void CemuUpdateWindow::OnClose(wxCloseEvent& event)
const auto apppath = exePath / L"update.sh";
execlp("sh", "sh", apppath.c_str(), NULL);

exit(0);
exit(0);
}
#endif
}
Expand Down

0 comments on commit 9d12faa

Please sign in to comment.