Compare commits
No commits in common. "495431f58767115018015ac9defc0ad25315eaa7" and "cd509a92f3d7a0d92a883712d98173c8a04eb04e" have entirely different histories.
495431f587
...
cd509a92f3
4 changed files with 12 additions and 1 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
builddir
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
project('dotty', 'cpp')
|
||||
|
||||
executable('dotty', 'main.cpp', dependencies: [])
|
||||
executable('dotty', 'src/main.cpp', dependencies: [])
|
||||
|
|
|
|||
|
|
@ -8,3 +8,7 @@ run = "meson setup --reconfigure builddir"
|
|||
[tasks.compile]
|
||||
dir = "{{ cwd }}/builddir"
|
||||
run = "meson compile"
|
||||
|
||||
[tasks.run]
|
||||
dir = "{{ cwd }}/builddir"
|
||||
run = "chmod +x dotty; sudo ./dotty"
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace std::filesystem;
|
||||
|
|
@ -14,6 +15,11 @@ const path PACMAN_HOOKS = "/etc/pacman.d/hooks";
|
|||
//
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
if (geteuid() != 0) {
|
||||
cout << "Sudo permissions are required to run this application";
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!exists(PACMAN_HOOKS)) {
|
||||
create_directory(PACMAN_HOOKS);
|
||||
cout << "Directory created: " << PACMAN_HOOKS << endl;
|
||||
Loading…
Add table
Add a link
Reference in a new issue