summaryrefslogtreecommitdiffstats
path: root/src/common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common.c')
-rw-r--r--src/common.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/common.c b/src/common.c
index 559f342..d4b7c8d 100644
--- a/src/common.c
+++ b/src/common.c
@@ -2,8 +2,8 @@
* common.c
* Misc functions used in idevicerestore
*
+ * Copyright (c) 2012-2019 Nikias Bassen. All Rights Reserved.
* Copyright (c) 2012 Martin Szulecki. All Rights Reserved.
- * Copyright (c) 2012 Nikias Bassen. All Rights Reserved.
* Copyright (c) 2010 Joshua Hill. All Rights Reserved.
*
* This library is free software; you can redistribute it and/or
@@ -35,7 +35,6 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <ctype.h>
-#include <unistd.h>
#ifdef WIN32
#include <windows.h>
@@ -486,6 +485,24 @@ char* strsep(char** strp, const char* delim)
}
#endif
+#ifndef HAVE_REALPATH
+char* realpath(const char *filename, char *resolved_name)
+{
+#ifdef WIN32
+ if (access(filename, F_OK) != 0) {
+ return NULL;
+ }
+ if (GetFullPathName(filename, MAX_PATH, resolved_name, NULL) == 0) {
+ return NULL;
+ }
+ return resolved_name;
+#else
+#error please provide a realpath implementation for this platform
+ return NULL;
+#endif
+}
+#endif
+
#ifdef WIN32
#define BS_CC '\b'
#define my_getch getch