Skip to content

Commit

Permalink
chore: remove unused methods
Browse files Browse the repository at this point in the history
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
  • Loading branch information
Scrumplex committed Dec 16, 2023
1 parent 2139632 commit a8220cd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 67 deletions.
62 changes: 0 additions & 62 deletions launcher/DesktopServices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,63 +39,6 @@
#include <QProcess>
#include "FileSystem.h"

/**
* This shouldn't exist, but until QTBUG-9328 and other unreported bugs are fixed, it needs to be a thing.
*/
#if defined(Q_OS_LINUX) || defined(Q_OS_FREEBSD)

#include <errno.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>

template <typename T>
bool IndirectOpen(T callable, qint64* pid_forked = nullptr)
{
auto pid = fork();
if (pid_forked) {
if (pid > 0)
*pid_forked = pid;
else
*pid_forked = 0;
}
if (pid == -1) {
qWarning() << "IndirectOpen failed to fork: " << errno;
return false;
}
// child - do the stuff
if (pid == 0) {
// unset all this garbage so it doesn't get passed to the child process
qunsetenv("LD_PRELOAD");
qunsetenv("LD_LIBRARY_PATH");
qunsetenv("LD_DEBUG");
qunsetenv("QT_PLUGIN_PATH");
qunsetenv("QT_FONTPATH");

// open the URL
auto status = callable();

// detach from the parent process group.
setsid();

// die. now. do not clean up anything, it would just hang forever.
_exit(status ? 0 : 1);
} else {
// parent - assume it worked.
int status;
while (waitpid(pid, &status, 0)) {
if (WIFEXITED(status)) {
return WEXITSTATUS(status) == 0;
}
if (WIFSIGNALED(status)) {
return false;
}
}
return true;
}
}
#endif

namespace DesktopServices {
bool openPath(const QFileInfo& path, bool ensureExists)
{
Expand Down Expand Up @@ -141,9 +84,4 @@ bool isSnap()
#endif
}

bool isSandbox()
{
return isSnap() || isFlatpak();
}

} // namespace DesktopServices
5 changes: 0 additions & 5 deletions launcher/DesktopServices.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,4 @@ bool isFlatpak();
* Determine whether the launcher is running in a Snap environment
*/
bool isSnap();

/**
* Determine whether the launcher is running in a sandboxed (Flatpak or Snap) environment
*/
bool isSandbox();
} // namespace DesktopServices

0 comments on commit a8220cd

Please sign in to comment.