FileAutoRenamer+Extensions.swift 771 B

123456789101112131415161718192021
  1. //
  2. // FileAutoRenamer+Extensions.swift
  3. // Nextcloud
  4. //
  5. // Created by Milen Pivchev on 10.10.24.
  6. // Copyright © 2024 Marino Faggiana. All rights reserved.
  7. //
  8. import NextcloudKit
  9. extension FileAutoRenamer {
  10. private func setup(account: String?) {
  11. let capabilities = NCCapabilities.shared.getCapabilities(account: account)
  12. FileAutoRenamer.shared.setup(forbiddenFileNameCharacters: capabilities.capabilityForbiddenFileNameCharacters, forbiddenFileNameExtensions: capabilities.capabilityForbiddenFileNameExtensions)
  13. }
  14. func rename(_ filename: String, isFolderPath: Bool = false, account: String?) -> String {
  15. setup(account: account)
  16. return FileAutoRenamer.shared.rename(filename: filename, isFolderPath: isFolderPath)
  17. }
  18. }