| 1048 | #define AUTOSTARTPATH "config" PATHDIVS "autostart" PATHDIVS |
| 1049 | |
| 1050 | void autostartscripts(const char *prefix) |
| 1051 | { |
| 1052 | static vector<char *> *files = NULL; |
| 1053 | if(!files) |
| 1054 | { // first run: fetch file names and sort them |
| 1055 | files = new vector<char *>; |
| 1056 | listfiles(AUTOSTARTPATH, "cfg", *files, stringsort); |
| 1057 | } |
| 1058 | loopv(*files) |
| 1059 | { |
| 1060 | if(*prefix && strncmp((*files)[i], prefix, strlen(prefix))) continue; |
| 1061 | defformatstring(p)(AUTOSTARTPATH "%s.cfg", (*files)[i]); |
| 1062 | execfile(p); |
| 1063 | delstring(files->remove(i--)); |
| 1064 | } |
| 1065 | } |
| 1066 | |
| 1067 | void createconfigtemplates(const char *templatezip) // create customisable config files in homedir - only if missing |
| 1068 | { |