aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/ideviceinstaller/001_fix_windows.patch
blob: 16f1149ffd220601ab12b65dae78fb609186efa8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
diff --git a/src/ideviceinstaller.c b/src/ideviceinstaller.c
index c50bacf..e4a8c3d 100644
--- a/src/ideviceinstaller.c
+++ b/src/ideviceinstaller.c
@@ -32,7 +32,9 @@
 #include <getopt.h>
 #include <errno.h>
 #include <time.h>
+#ifndef _MSC_VER
 #include <libgen.h>
+#endif
 #include <inttypes.h>
 #include <limits.h>
 #include <sys/stat.h>
@@ -87,6 +89,32 @@ static int asprintf(char **PTR, const char *TEMPLATE, ...)
 }
 #endif
 
+#ifdef _MSC_VER
+#ifndef ISSLASH
+#define ISSLASH(C) ((C) == '/' || (C) == '\\')
+#endif
+char *basename(char const *name) {
+    char const *base = name;
+    char const *p;
+    for (p = base; *p; p++) {
+        if (ISSLASH(*p)) {
+            do p++;
+            while (ISSLASH(*p));
+
+            if (!*p) {
+                if (ISSLASH(*base))
+                    base = p - 1;
+                break;
+            }
+
+            base = p;
+        }
+    }
+
+    return (char *) base;
+}
+#endif
+
 #define ITUNES_METADATA_PLIST_FILENAME "iTunesMetadata.plist"
 
 const char PKG_PATH[] = "PublicStaging";