@@ -126,7 +126,7 @@ struct SelfUninstall: SwiftlyCommand {
126
126
await ctx. print ( " Swiftly binary found at \( swiftlyBinary) , removing it... " )
127
127
}
128
128
try await fs. remove ( atPath: swiftlyBin / " swiftly " )
129
- }
129
+ }
130
130
131
131
let entries = try await fs. ls ( atPath: swiftlyBin)
132
132
if entries . isEmpty {
@@ -156,12 +156,38 @@ struct SelfUninstall: SwiftlyCommand {
156
156
}
157
157
if let homeFiles = homeFiles, homeFiles. contains ( " env.fish " ) {
158
158
if verbose {
159
- await ctx. print ( " Removing swiftly env.fish file at \( swiftlyHome / " env.fish " ) ... " )
159
+ await ctx. print ( " Removing swiftly env.fish file at \( swiftlyHome / " env.fish " ) ... " )
160
160
}
161
161
try await fs. remove ( atPath: swiftlyHome / " env.fish " )
162
162
}
163
+
164
+ // we should also check for share/doc/swiftly/license/LICENSE.txt
165
+ let licensePath = swiftlyHome / " share/doc/swiftly/license/LICENSE.txt "
166
+ if
167
+ try await fs. exists ( atPath: licensePath)
168
+ {
169
+ if verbose {
170
+ await ctx. print ( " Removing swiftly license file at \( licensePath) ... " )
171
+ }
172
+ try await fs. remove ( atPath: licensePath)
173
+ }
174
+
175
+ // removes each of share/doc/swiftly/license directories if they are empty
176
+ let licenseDir = swiftlyHome / " share/doc/swiftly/license "
177
+ if try await fs. exists ( atPath: licenseDir) {
178
+ let licenseEntries = try await fs. ls ( atPath: licenseDir)
179
+ if licenseEntries. isEmpty {
180
+ if verbose {
181
+ await ctx. print ( " Swiftly license directory at \( licenseDir) is empty, removing it... " )
182
+ }
183
+ try await fs. remove ( atPath: licenseDir)
184
+ }
185
+ }
186
+
163
187
// if now the swiftly home directory is empty, remove it
164
188
let homeEntries = try await fs. ls ( atPath: swiftlyHome)
189
+ await ctx. print ( " Checking swiftly home directory entries... " )
190
+ await ctx. print ( " still present: \( homeEntries. joined ( separator: " , " ) ) " )
165
191
if homeEntries . isEmpty {
166
192
if verbose {
167
193
await ctx. print ( " Swiftly home directory at \( swiftlyHome) is empty, removing it... " )
0 commit comments