@@ -295,14 +295,15 @@ extension FileManager {
295
295
destPath. isAbsolutePath ? destPath
296
296
: joinPath ( prefix: path. deletingLastPathComponent,
297
297
suffix: destPath)
298
+
299
+ // NOTE: windowsfileAttributes will throw if the destPath is not
300
+ // found. Since on Windows, you are required to know the type
301
+ // of the symlink target (file or directory) during creation,
302
+ // and assuming one or the other doesn't make a lot of sense, we
303
+ // allow it to throw, thus disallowing the creation of broken
304
+ // symlinks on Windows is the target is of unknown type.
298
305
guard let faAttributes = try ? windowsFileAttributes ( atPath: resolvedDest) else {
299
- // Note: windowsfileAttributes will throw if the destPath is not found.
300
- // Since on Windows, you are required to know the type of the symlink
301
- // target (file or directory) during creation, and assuming one or the
302
- // other doesn't make a lot of sense, we allow it to throw, thus
303
- // disallowing the creation of broken symlinks on Windows is the target
304
- // is of unknown type.
305
- throw _NSErrorWithWindowsError ( GetLastError ( ) , reading: true , paths: [ path, resolvedDest] )
306
+ throw _NSErrorWithWindowsError ( GetLastError ( ) , reading: true , paths: [ path, destPath] )
306
307
}
307
308
if faAttributes. dwFileAttributes & DWORD ( FILE_ATTRIBUTE_DIRECTORY) == DWORD ( FILE_ATTRIBUTE_DIRECTORY) {
308
309
dwFlags |= DWORD ( SYMBOLIC_LINK_FLAG_DIRECTORY)
0 commit comments