Compare commits

..

No commits in common. "495431f58767115018015ac9defc0ad25315eaa7" and "cd509a92f3d7a0d92a883712d98173c8a04eb04e" have entirely different histories.

4 changed files with 12 additions and 1 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
builddir

View file

@ -1,3 +1,3 @@
project('dotty', 'cpp') project('dotty', 'cpp')
executable('dotty', 'main.cpp', dependencies: []) executable('dotty', 'src/main.cpp', dependencies: [])

View file

@ -8,3 +8,7 @@ run = "meson setup --reconfigure builddir"
[tasks.compile] [tasks.compile]
dir = "{{ cwd }}/builddir" dir = "{{ cwd }}/builddir"
run = "meson compile" run = "meson compile"
[tasks.run]
dir = "{{ cwd }}/builddir"
run = "chmod +x dotty; sudo ./dotty"

View file

@ -2,6 +2,7 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <stdio.h> #include <stdio.h>
#include <unistd.h>
using namespace std; using namespace std;
using namespace std::filesystem; using namespace std::filesystem;
@ -14,6 +15,11 @@ const path PACMAN_HOOKS = "/etc/pacman.d/hooks";
// //
int main(int argc, char **argv) { int main(int argc, char **argv) {
if (geteuid() != 0) {
cout << "Sudo permissions are required to run this application";
return 0;
}
if (!exists(PACMAN_HOOKS)) { if (!exists(PACMAN_HOOKS)) {
create_directory(PACMAN_HOOKS); create_directory(PACMAN_HOOKS);
cout << "Directory created: " << PACMAN_HOOKS << endl; cout << "Directory created: " << PACMAN_HOOKS << endl;