From 64e88489ee47f4e5dca458970688485a0a165c30 Mon Sep 17 00:00:00 2001 From: Nikias Bassen Date: Thu, 14 Feb 2019 00:26:25 +0100 Subject: Allow .ipsw files or extracted IPSW as source --- src/common.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'src/common.c') 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 #include #include -#include #ifdef WIN32 #include @@ -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 -- cgit v1.1-32-gdbae