aboutsummaryrefslogtreecommitdiff
path: root/src/common.c
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2021-05-08 23:24:08 +0200
committerJan200101 <sentrycraft123@gmail.com>2021-05-08 23:24:08 +0200
commit6cc1ec3610ba98bada1fcd03a654b2925530f748 (patch)
treed772a02517cc8022100be2a89f8e4000559066ba /src/common.c
parent14e8bfdc0a83a1256f2efc92868ead7dbd26bc51 (diff)
downloadpolecat-6cc1ec3610ba98bada1fcd03a654b2925530f748.tar.gz
polecat-6cc1ec3610ba98bada1fcd03a654b2925530f748.zip
add work in progress windows support
to run lutris installers on windows soon
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/common.c b/src/common.c
index ae2087e..b17848b 100644
--- a/src/common.c
+++ b/src/common.c
@@ -48,14 +48,14 @@ void print_help(const struct Command* commands, const size_t commands_size,
for (size_t i = 0; i < flags_size; ++i)
{
fprintf(stderr, "\t");
- if (flags[i].variant & SINGLE)
+ if (flags[i].variant & ONE)
fprintf(stderr, "-%c", flags[i].name[0]);
else
fprintf(stderr, " ");
- if (flags[i].variant & DOUBLE)
+ if (flags[i].variant & TWO)
{
- if (flags[i].variant & SINGLE) fprintf(stderr, ",");
+ if (flags[i].variant & ONE) fprintf(stderr, ",");
fprintf(stderr, " --%-*s", (int)longestStr, flags[i].name);
}
@@ -80,14 +80,22 @@ int isFile(const char* path)
{
struct stat sb = getStat(path);
- return S_ISREG(sb.st_mode) || S_ISLNK(sb.st_mode);
+ return S_ISREG(sb.st_mode)
+#ifndef _WIN32
+ || S_ISLNK(sb.st_mode)
+#endif
+ ;
}
int isDir(const char* path)
{
struct stat sb = getStat(path);
- return S_ISDIR(sb.st_mode) || S_ISLNK(sb.st_mode);
+ return S_ISDIR(sb.st_mode)
+#ifndef _WIN32
+ || S_ISLNK(sb.st_mode)
+#endif
+ ;
}
int makeDir(const char* path)
@@ -145,8 +153,10 @@ int removeDir(const char *path)
if (!stat(buf, &statbuf)) {
if (S_ISDIR(statbuf.st_mode))
r = removeDir(buf);
+#ifndef _WIN32
else if (S_ISLNK(statbuf.st_mode))
r = unlink(buf);
+#endif
else
r = remove(buf);
}