@@ -4085,9 +4085,10 @@ extension Workspace.Location {
4085
4085
4086
4086
// check that shared configuration directory is accessible, or warn + reset if not
4087
4087
if let sharedConfigurationDirectory = self . sharedConfigurationDirectory {
4088
- // it may not always be possible to create default location (for example de to restricted sandbox)
4088
+ // It may not always be possible to create default location (for example de to restricted sandbox),
4089
+ // in which case defaultDirectory would be nil.
4089
4090
let defaultDirectory = try ? fileSystem. getOrCreateSwiftPMConfigurationDirectory ( warningHandler: warningHandler)
4090
- if sharedConfigurationDirectory != defaultDirectory {
4091
+ if defaultDirectory != nil , sharedConfigurationDirectory != defaultDirectory {
4091
4092
// custom location must be writable, throw if we cannot access it
4092
4093
try withTemporaryFile ( dir: sharedConfigurationDirectory) { _ in }
4093
4094
} else {
@@ -4103,9 +4104,10 @@ extension Workspace.Location {
4103
4104
4104
4105
// check that shared configuration directory is accessible, or warn + reset if not
4105
4106
if let sharedSecurityDirectory = self . sharedSecurityDirectory {
4106
- // it may not always be possible to create default location (for example de to restricted sandbox)
4107
+ // It may not always be possible to create default location (for example de to restricted sandbox),
4108
+ // in which case defaultDirectory would be nil.
4107
4109
let defaultDirectory = try ? fileSystem. getOrCreateSwiftPMSecurityDirectory ( )
4108
- if sharedSecurityDirectory != defaultDirectory {
4110
+ if defaultDirectory != nil , sharedSecurityDirectory != defaultDirectory {
4109
4111
// custom location must be writable, throw if we cannot access it
4110
4112
try withTemporaryFile ( dir: sharedSecurityDirectory) { _ in }
4111
4113
} else {
@@ -4121,9 +4123,10 @@ extension Workspace.Location {
4121
4123
4122
4124
// check that shared configuration directory is accessible, or warn + reset if not
4123
4125
if let sharedCacheDirectory = self . sharedCacheDirectory {
4124
- // it may not always be possible to create default location (for example de to restricted sandbox)
4126
+ // It may not always be possible to create default location (for example de to restricted sandbox),
4127
+ // in which case defaultDirectory would be nil.
4125
4128
let defaultDirectory = try ? fileSystem. getOrCreateSwiftPMCacheDirectory ( )
4126
- if sharedCacheDirectory != defaultDirectory {
4129
+ if defaultDirectory != nil , sharedCacheDirectory != defaultDirectory {
4127
4130
// custom location must be writable, throw if we cannot access it
4128
4131
try withTemporaryFile ( dir: sharedCacheDirectory) { _ in }
4129
4132
} else {
0 commit comments