check for modifications
This commit is contained in:
Binary file not shown.
@@ -7,6 +7,8 @@
|
|||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
@@ -16,6 +18,7 @@ class DATA {
|
|||||||
string loc = "";
|
string loc = "";
|
||||||
string script = "";
|
string script = "";
|
||||||
string name = "";
|
string name = "";
|
||||||
|
bool disabled = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline void trim(string &s) {
|
static inline void trim(string &s) {
|
||||||
@@ -76,13 +79,19 @@ void loadfile(vector<DATA> &scripts) {
|
|||||||
istringstream iss(line);
|
istringstream iss(line);
|
||||||
string str = iss.str();
|
string str = iss.str();
|
||||||
|
|
||||||
if (str.length() == 0 || str.substr(0,1) == "#")
|
if (str.length() == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
DATA data;
|
DATA data;
|
||||||
|
|
||||||
|
if (str[0] == '#') {
|
||||||
|
data.disabled = true;
|
||||||
|
str = str.substr(1);
|
||||||
|
}
|
||||||
|
|
||||||
splitData(str, data);
|
splitData(str, data);
|
||||||
|
|
||||||
if (data.loc.length() == 0) {
|
if (data.loc.length() == 0 || data.script.length() == 0 || data.name.length() == 0) {
|
||||||
cout << "WARNING: skipping line " << linenum << endl;
|
cout << "WARNING: skipping line " << linenum << endl;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -103,6 +112,18 @@ int main() {
|
|||||||
DATA data = scripts.at(i);
|
DATA data = scripts.at(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct stat sb;
|
||||||
|
time_t mtime = 0;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
stat("scripts", &sb);
|
||||||
|
if (sb.st_mtime > mtime) {
|
||||||
|
mtime = sb.st_mtime;
|
||||||
|
cout << "modified" << endl;
|
||||||
|
}
|
||||||
|
sleep(1);
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
~/discordBots/autovc/ start
|
~/discordBots/autovc/ start
|
||||||
~/discordBots/autorole/ start
|
~/discordBots/autorole/ start
|
||||||
#~/discordBots/funnyBike/cleverbot/ start
|
#~/discordBots/funnyBike/cleverbot-bot/ start
|
||||||
#~/discordBots/funnyBike/watch-it-talk/ start
|
#~/discordBots/funnyBike/watch-cleverbot-talk/ start
|
||||||
#~/discordBots/funnyBike/wolframalpha/ start
|
#~/discordBots/funnyBike/wolframalpha/ start
|
||||||
~/discordBots/IKEA-Canada-Support/rolemanager tmux
|
~/discordBots/IKEA-Canada-Support/rolemanager tmux
|
||||||
~/discordBots/thom wishlane server/rolemanager tmux
|
~/discordBots/thom wishlane server/rolemanager tmux
|
||||||
Reference in New Issue
Block a user