Overview
Comment: | Add support for hardlinks and symlinks on Windows |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
768b31dede33c0c0ed495e9d4b76ba1c |
User & Date: | js on 2016-07-03 22:40:35 |
Other Links: | manifest | tags |
Context
2016-07-04
| ||
19:36 | Remove check for objc_enumerationMutation check-in: 32d092b9ba user: js tags: trunk | |
2016-07-03
| ||
22:40 | Add support for hardlinks and symlinks on Windows check-in: 768b31dede user: js tags: trunk | |
19:38 | -[pathComponents]: Include drive in 1st component check-in: 541aab7a03 user: js tags: trunk | |
Changes
Modified configure.ac from [8a62215e9e] to [9b304b3c2a].
︙ | |||
804 805 806 807 808 809 810 811 812 813 814 815 816 817 | 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 | + + + | ]) AC_CHECK_FUNC(link, [ AC_DEFINE(OF_HAVE_LINK, 1, [Whether we have link()]) ]) AC_CHECK_FUNC(symlink, [ AC_DEFINE(OF_HAVE_SYMLINK, 1, [Whether we have symlink()]) ]) AC_CHECK_FUNC(readlink, [ AC_DEFINE(OF_HAVE_READLINK, 1, [Whether we have readlink()]) ]) AC_CHECK_FUNCS([lstat readdir_r]) ]) AC_CHECK_FUNCS([sysconf gmtime_r localtime_r nanosleep fcntl]) AC_CHECK_FUNC(pipe, [ AC_DEFINE(OF_HAVE_PIPE, 1, [Whether we have pipe()]) |
︙ |
Modified src/OFFileManager.h from [8d6a926fea] to [0fb12497fc].
︙ | |||
223 224 225 226 227 228 229 | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | - + - + - + - + + + + + + | * * If the item at the specified path is a directory, it is removed recursively. * * @param path The path to the item which should be removed */ - (void)removeItemAtPath: (OFString*)path; |
Modified src/OFFileManager.m from [828aa0d8f5] to [d13c205905].
︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | + | #import "OFCreateDirectoryFailedException.h" #import "OFCreateSymbolicLinkFailedException.h" #import "OFInitializationFailedException.h" #import "OFInvalidArgumentException.h" #import "OFLinkFailedException.h" #import "OFLockFailedException.h" #import "OFMoveItemFailedException.h" #import "OFNotImplementedException.h" #import "OFOpenItemFailedException.h" #import "OFOutOfMemoryException.h" #import "OFReadFailedException.h" #import "OFRemoveItemFailedException.h" #import "OFStatItemFailedException.h" #import "OFUnlockFailedException.h" |
︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 | 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | + + + + | #if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) static OFMutex *passwdMutex; #endif #if !defined(HAVE_READDIR_R) && !defined(OF_WINDOWS) && defined(OF_HAVE_THREADS) static OFMutex *readdirMutex; #endif #ifdef OF_WINDOWS static WINAPI BOOLEAN (*func_CreateSymbolicLinkW)(LPCWSTR, LPCWSTR, DWORD); #endif int of_stat(OFString *path, of_stat_t *buffer) { #if defined(OF_WINDOWS) return _wstat64([path UTF16String], buffer); #elif defined(OF_HAVE_OFF64_T) |
︙ | |||
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | + + + + + + + + + + + | # endif #endif } @implementation OFFileManager + (void)initialize { #ifdef OF_WINDOWS HMODULE module; #endif if (self != [OFFileManager class]) return; /* * Make sure OFFile is initialized. * On some systems, this is needed to initialize the file system driver. */ [OFFile class]; #if defined(OF_HAVE_CHOWN) && defined(OF_HAVE_THREADS) passwdMutex = [[OFMutex alloc] init]; #endif #if !defined(HAVE_READDIR_R) && !defined(OF_WINDOWS) && defined(OF_HAVE_THREADS) readdirMutex = [[OFMutex alloc] init]; #endif #ifdef OF_WINDOWS if ((module = LoadLibrary("kernel32.dll")) != NULL) func_CreateSymbolicLinkW = (WINAPI BOOLEAN (*)(LPCWSTR, LPCWSTR, DWORD)) GetProcAddress(module, "CreateSymbolicLinkW"); #endif defaultManager = [[OFFileManager alloc] init]; } + (OFFileManager*)defaultManager { return defaultManager; |
︙ | |||
871 872 873 874 875 876 877 | 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 | - + | exceptionWithPath: path errNo: errno]; } objc_autoreleasePoolPop(pool); } |
︙ | |||
893 894 895 896 897 898 899 900 901 | 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 | + + + + + + + + + + + + + + + + + + + - + | @throw [OFLinkFailedException exceptionWithSourcePath: source destinationPath: destination errNo: errno]; objc_autoreleasePoolPop(pool); } #else - (void)linkItemAtPath: (OFString*)source toPath: (OFString*)destination { void *pool; if (source == nil || destination == nil) @throw [OFInvalidArgumentException exception]; pool = objc_autoreleasePoolPush(); if (!CreateHardLinkW([destination UTF16String], [source UTF16String], NULL)) @throw [OFLinkFailedException exceptionWithSourcePath: source destinationPath: destination]; objc_autoreleasePoolPop(pool); } #endif |
︙ | |||
917 918 919 920 921 922 923 | 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 | + + + - + + + + + + + + + + + + + + + + + + + + + + + | @throw [OFCreateSymbolicLinkFailedException exceptionWithSourcePath: source destinationPath: destination errNo: errno]; objc_autoreleasePoolPop(pool); } #elif defined(OF_WINDOWS) - (void)createSymbolicLinkAtPath: (OFString*)destination withDestinationPath: (OFString*)source |
︙ |
Modified src/exceptions/OFCreateSymbolicLinkFailedException.h from [15147c1170] to [f563bb643a].
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" |
︙ | |||
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | + + + + + + + + + + + + + + + + + + + + + | @property (readonly) int errNo; /*! * @brief Creates a new, autoreleased create symbolic link failed exception. * * @param sourcePath The source for the symbolic link * @param destinationPath The destination for the symbolic link * @return A new, autoreleased create symbolic link failed exception */ + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath; /*! * @brief Creates a new, autoreleased create symbolic link failed exception. * * @param sourcePath The source for the symbolic link * @param destinationPath The destination for the symbolic link * @param errNo The errno of the error that occurred * @return A new, autoreleased create symbolic link failed exception */ + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; /*! * @brief Initializes an already allocated create symbolic link failed * exception. * * @param sourcePath The source for the symbolic link * @param destinationPath The destination for the symbolic link * @return An initialized create symbolic link failed exception */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath; /*! * @brief Initializes an already allocated create symbolic link failed * exception. * * @param sourcePath The source for the symbolic link * @param destinationPath The destination for the symbolic link * @param errNo The errno of the error that occurred |
︙ |
Modified src/exceptions/OFCreateSymbolicLinkFailedException.m from [fc02c53f72] to [3c5d7c863e].
︙ | |||
15 16 17 18 19 20 21 | 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - + + + + + + + + + + + + + + + + + + + + + + + + | */ #include "config.h" #import "OFCreateSymbolicLinkFailedException.h" #import "OFString.h" |
︙ | |||
62 63 64 65 66 67 68 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | + - - - + + + + + + + + | [_destinationPath release]; [super dealloc]; } - (OFString*)description { if (_errNo != 0) |
Modified src/exceptions/OFLinkFailedException.h from [d5b885ed6e] to [d7ba6d4dbb].
︙ | |||
12 13 14 15 16 17 18 | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | - + | * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFException.h" |
︙ | |||
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 | + + + + + + + + + + + + + + + + + + + + | * The errno of the error that occurred. */ @property (readonly) int errNo; /*! * @brief Creates a new, autoreleased link failed exception. * * @param sourcePath The source for the link * @param destinationPath The destination for the link * @return A new, autoreleased link failed exception */ + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath; /*! * @brief Creates a new, autoreleased link failed exception. * * @param sourcePath The source for the link * @param destinationPath The destination for the link * @param errNo The errno of the error that occurred * @return A new, autoreleased link failed exception */ + (instancetype)exceptionWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; /*! * @brief Initializes an already allocated link failed exception. * * @param sourcePath The source for the link * @param destinationPath The destination for the link * @return An initialized link failed exception */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath; /*! * @brief Initializes an already allocated link failed exception. * * @param sourcePath The source for the link * @param destinationPath The destination for the link * @param errNo The errno of the error that occurred * @return An initialized link failed exception */ - initWithSourcePath: (OFString*)sourcePath destinationPath: (OFString*)destinationPath errNo: (int)errNo; @end #endif |
Modified src/exceptions/OFLinkFailedException.m from [71bc83ac12] to [3fe16945e2].
︙ | |||
15 16 17 18 19 20 21 | 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | - + + + + + + + + + + + + + + + + + + + + + + + + | */ #include "config.h" #import "OFLinkFailedException.h" #import "OFString.h" |
︙ | |||
62 63 64 65 66 67 68 | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | + - - - + + + + + + + | [_destinationPath release]; [super dealloc]; } - (OFString*)description { if (_errNo != 0) |
Modified src/objfw-defs.h.in from [84b0a50859] to [427af0f6c6].
︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | + | #undef OF_HAVE_OSATOMIC_64 #undef OF_HAVE_PIPE #undef OF_HAVE_PLUGINS #undef OF_HAVE_PROCESSES #undef OF_HAVE_PTHREADS #undef OF_HAVE_PTHREAD_SPINLOCKS #undef OF_HAVE_RECURSIVE_PTHREAD_MUTEXES #undef OF_HAVE_READLINK #undef OF_HAVE_SCHED_YIELD #undef OF_HAVE_SOCKETS #undef OF_HAVE_STDNORETURN #undef OF_HAVE_SYMLINK #undef OF_HAVE_SYS_SOCKET_H #undef OF_HAVE_THREADS #undef OF_HAVE___THREAD #undef OF_HAVE__THREAD_LOCAL #undef OF_NINTENDO_DS #undef OF_OBJFW_RUNTIME #undef OF_UNIVERSAL #undef SIZE_MAX |