diff --git a/meson.build b/meson.build index 5da9583..34c75cc 100644 --- a/meson.build +++ b/meson.build @@ -1,3 +1,3 @@ project('dotty', 'cpp') -executable('dotty', 'main.cpp', dependencies: []) +executable('dotty', 'src/main.cpp', dependencies: []) diff --git a/main.cpp b/src/main.cpp similarity index 77% rename from main.cpp rename to src/main.cpp index dbf8f8e..b3744b0 100644 --- a/main.cpp +++ b/src/main.cpp @@ -2,6 +2,7 @@ #include #include #include +#include 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;