File tree Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Expand file tree Collapse file tree 1 file changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -269,20 +269,20 @@ extension FileManager {
269269 }
270270 }
271271
272- try FileManager . default. _fileSystemRepresentation ( withPath: path) { fsr in
273- var saAttributes : SECURITY_ATTRIBUTES =
274- SECURITY_ATTRIBUTES ( nLength: DWORD ( MemoryLayout< SECURITY_ATTRIBUTES> . size) ,
275- lpSecurityDescriptor: nil ,
276- bInheritHandle: false )
277- try withUnsafeMutablePointer ( to: & saAttributes) {
278- if !CreateDirectoryW( fsr, $0) {
279- throw _NSErrorWithWindowsError ( GetLastError ( ) , reading: false , paths: [ path] )
272+ try withNTPathRepresentation ( of: path) { wszPath in
273+ var saAttributes : SECURITY_ATTRIBUTES =
274+ SECURITY_ATTRIBUTES ( nLength: DWORD ( MemoryLayout< SECURITY_ATTRIBUTES> . size) ,
275+ lpSecurityDescriptor: nil ,
276+ bInheritHandle: false )
277+ try withUnsafeMutablePointer ( to: & saAttributes) { pSecurityAttributes in
278+ guard CreateDirectoryW ( wszPath, pSecurityAttributes) else {
279+ throw _NSErrorWithWindowsError ( GetLastError ( ) , reading: false , paths: [ path] )
280+ }
280281 }
281- }
282+ }
282283
283- if let attr = attributes {
284- try self . setAttributes ( attr, ofItemAtPath: path)
285- }
284+ if let attributes {
285+ try self . setAttributes ( attributes, ofItemAtPath: path)
286286 }
287287 }
288288
You can’t perform that action at this time.
0 commit comments