KMMergeViewModel.swift 664 B

123456789101112131415161718192021222324252627282930
  1. //
  2. // KMMergeViewModel.swift
  3. // PDF Reader Pro
  4. //
  5. // Created by User-Tangchao on 2024/9/30.
  6. //
  7. import Cocoa
  8. class KMMergeViewModel: NSObject {
  9. var fileUrl: URL?
  10. var oriFileUrl: URL?
  11. var isImage = false
  12. func fetchFileName() -> String? {
  13. if isImage {
  14. return self.oriFileUrl?.deletingPathExtension().lastPathComponent
  15. } else {
  16. return self.fileUrl?.deletingPathExtension().lastPathComponent
  17. }
  18. }
  19. func fetchFileExn() -> String? {
  20. if isImage {
  21. return self.oriFileUrl?.pathExtension
  22. } else {
  23. return self.fileUrl?.pathExtension
  24. }
  25. }
  26. }