Skip to content

Commit

Permalink
Move the URL extensions into URL.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
jbmorley committed Feb 18, 2024
1 parent 09e5ec2 commit 5a99719
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
23 changes: 23 additions & 0 deletions Sources/InContextCore/Extensions/URL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,26 @@ extension URL {
}

}

#if os(Linux)

enum DirectoryHint {

case isDirectory
case notDirectory

}

extension URL {

init(filePath: String, directoryHint: DirectoryHint = .notDirectory) {
self.init(fileURLWithPath: filePath, isDirectory: directoryHint == .isDirectory ? true : false)
}

init(filePath: String, relativeTo url: URL?) {
self.init(fileURLWithPath: filePath, relativeTo: url)
}

}

#endif
19 changes: 0 additions & 19 deletions Sources/InContextCore/Utilities/ChangeObserver.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,6 @@ import Foundation
import FSEventsWrapper
#endif

enum DirectoryHint {

case isDirectory
case notDirectory

}

extension URL {

init(filePath: String, directoryHint: DirectoryHint = .notDirectory) {
self.init(fileURLWithPath: filePath, isDirectory: directoryHint == .isDirectory ? true : false)
}

init(filePath: String, relativeTo url: URL?) {
self.init(fileURLWithPath: filePath, relativeTo: url)
}

}

class ChangeObserver {

let box: ConcurrentBox<Bool>
Expand Down

0 comments on commit 5a99719

Please sign in to comment.