MCPcopy Create free account
hub / github.com/TheAssassin/AppImageLauncher / makeExecutable

Function makeExecutable

src/shared/shared.cpp:54–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54bool makeExecutable(const QString& path) {
55 struct stat fileStat{};
56
57 if (stat(path.toStdString().c_str(), &fileStat) != 0) {
58 std::cerr << "Failed to call stat() on " << path.toStdString() << std::endl;
59 return false;
60 }
61
62 // no action required when file is executable already
63 // this could happen in scenarios when an AppImage is in a read-only location
64 if ((fileStat.st_uid == getuid() && fileStat.st_mode & 0100) ||
65 (fileStat.st_gid == getgid() && fileStat.st_mode & 0010) ||
66 (fileStat.st_mode & 0001)) {
67 return true;
68 }
69
70 return chmod(path.toStdString().c_str(), fileStat.st_mode | 0111) == 0;
71}
72
73bool makeNonExecutable(const QString& path) {
74 struct stat fileStat{};

Callers 2

runAppImageFunction · 0.85

Calls 1

statClass · 0.70

Tested by

no test coverage detected