Skip to content

Commit 7cea3bf

Browse files
/remove command now removes the directory too
Added debug output with error file path
1 parent d104b98 commit 7cea3bf

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

NotifierBot/Sources/Notifier/Commands/RemoveCommand.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ struct RemoveCommand: Command {
3636
let realName = config[index!].name
3737
config.remove(at: index!)
3838
try ConfigParser.saveConfig(config)
39+
40+
// Remove the images folder
41+
let folderPath = "\(mainDirectory!)/urlwatcher/images/\(realName).\(chatID)"
42+
try FileManager.default.removeItem(atPath: folderPath)
43+
3944
try bot.sendMessage("Successfully removed '\(realName)'", to: chatID)
4045
}
4146

urlwatcher/Sources/urlwatcher/Functions.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func handleScreenshotError(entry: URLEntry) throws {
9696
// We do this, by checking for a file 'error' and its creation date to see when the error first appeared.
9797
// This file should be deleted on the next successful capture
9898
if !fileManager.fileExists(atPath: errorFile) {
99+
print("Creating error file at \(errorFile)")
99100
// If the error file does not exist yet, create a new one and return
100101
fileManager.createFile(atPath: errorFile, contents: nil)
101102
return

0 commit comments

Comments
 (0)