summaryrefslogtreecommitdiff
path: root/src/base/director.c
diff options
context:
space:
mode:
authorConnor Thomson <blumatrikz@gmail.com>2026-09-08 18:27:39 -0700
committerConnor Thomson <blumatrikz@gmail.com>2026-09-08 18:27:39 -0700
commitf1ddc12b68b4e4c8087962de25260470e6df2bea (patch)
tree7d0440a6402a9b0ef75ded23fa64b68534255bba /src/base/director.c
parent6025860a61386bf767b29c3ec5fd0d31285f1056 (diff)
Add tuxanci2 files
Diffstat (limited to 'src/base/director.c')
-rw-r--r--src/base/director.c69
1 files changed, 0 insertions, 69 deletions
diff --git a/src/base/director.c b/src/base/director.c
deleted file mode 100644
index 5c005cb..0000000
--- a/src/base/director.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include <dirent.h>
-#include <sys/types.h>
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <assert.h>
-
-#include "main.h"
-#include "list.h"
-
-typedef struct director_struct {
- char *path;
- list_t *list;
-} director_t;
-
-director_t *director_load(char *s)
-{
- director_t *new;
- DIR *dir;
- struct dirent *item;
- char path[STR_PATH_SIZE];
-
- assert(s != 0);
-
- new = malloc(sizeof(director_t));
- memset(new, 0, sizeof(director_t));
-
- new->list = list_new();
-
-#ifndef __WIN32__
- if (s[0] == '/') {
-#else
- if (s[1] == ':') {
-#endif
- strcpy(path, s);
- } else {
- /* this is really correct aproach */
- getcwd(path, STR_PATH_SIZE);
- strcat(path, PATH_SEPARATOR);
- strcat(path, s);
- }
-
- new->path = strdup(path);
- dir = opendir(new->path);
-
- if (dir == NULL) {
- free(new->path);
- free(new);
- return NULL;
- }
-
- while ((item = readdir(dir)) != NULL) {
- list_add(new->list, strdup(item->d_name));
- }
-
- closedir(dir);
-
- return new;
-}
-
-void director_destroy(director_t *p)
-{
- assert(p != NULL);
-
- list_destroy_item(p->list, free);
- free(p->path);
- free(p);
-}