commit b3cc61c20c1bef4bda24ae00baf32d99d080bd76
parent dcbadc5504795b1249a1a181f0eed800309b1227
Author: Nihal Jere <nihal@nihaljere.xyz>
Date: Thu, 18 Feb 2021 18:42:35 -0600
pkg.c: pkg_download: don't download if cached copy exists
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/pkg.c b/pkg.c
@@ -5,6 +5,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <unistd.h>
#include "http.h"
#include "pkg.h"
@@ -28,7 +29,9 @@ pkg_download(char *repo, char *name)
strcat(destpath, "/");
mkdirs(destpath);
strcat(destpath, basename(sources[i].url));
- http_fetch(sources[i].url, destpath);
+
+ if (access(destpath, F_OK))
+ http_fetch(sources[i].url, destpath);
}
}