-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
296 additions
and
67 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
Modules/Contracts/Providers/LocalFileURLProviderContract/Package.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// swift-tools-version: 5.8 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "LocalFileURLProviderContract", | ||
platforms: [ | ||
.macOS(.v12) | ||
], | ||
products: [ | ||
.library( | ||
name: "LocalFileURLProviderContract", | ||
targets: ["LocalFileURLProviderContract"]) | ||
], | ||
targets: [ | ||
.target( | ||
name: "LocalFileURLProviderContract" | ||
) | ||
] | ||
) |
3 changes: 3 additions & 0 deletions
3
Modules/Contracts/Providers/LocalFileURLProviderContract/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# LocalFileURLProviderContract | ||
|
||
A description of this package. |
5 changes: 5 additions & 0 deletions
5
...LProviderContract/Sources/LocalFileURLProviderContract/LocalFileURLProviderContract.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Foundation | ||
|
||
public protocol LocalFileURLProviderProtocol { | ||
func localFileURL() -> URL? | ||
} |
7 changes: 7 additions & 0 deletions
7
Modules/Features/GenerateFeature/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 28 additions & 28 deletions
56
Modules/Features/GenerateFeature/Sources/GenerateFeature/FileURLs/AshFileURLGetter.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,28 @@ | ||
import AppKit | ||
import Foundation | ||
|
||
struct AshFileURLGetter: LocalFileURLGetter { | ||
let fileURL: URL? | ||
|
||
func getUrl() -> URL? { | ||
let openPanel = NSOpenPanel() | ||
|
||
openPanel.directoryURL = fileURL?.deletingLastPathComponent() | ||
openPanel.allowsMultipleSelection = false | ||
openPanel.canChooseFiles = true | ||
openPanel.canChooseDirectories = true | ||
openPanel.canCreateDirectories = true | ||
openPanel.allowedContentTypes = [ | ||
.init(filenameExtension: "ash", | ||
conformingTo: .init("com.apple.package")!) | ||
].compactMap { $0 } | ||
|
||
openPanel.runModal() | ||
|
||
var url = openPanel.url | ||
if url?.lastPathComponent.hasSuffix(".ash") == true { | ||
url = url?.deletingLastPathComponent() | ||
} | ||
return url | ||
} | ||
} | ||
//import AppKit | ||
//import Foundation | ||
// | ||
//struct AshFileURLGetter: LocalFileURLGetter { | ||
// let fileURL: URL? | ||
// | ||
// func getUrl() -> URL? { | ||
// let openPanel = NSOpenPanel() | ||
// | ||
// openPanel.directoryURL = fileURL?.deletingLastPathComponent() | ||
// openPanel.allowsMultipleSelection = false | ||
// openPanel.canChooseFiles = true | ||
// openPanel.canChooseDirectories = true | ||
// openPanel.canCreateDirectories = true | ||
// openPanel.allowedContentTypes = [ | ||
// .init(filenameExtension: "ash", | ||
// conformingTo: .init("com.apple.package")!) | ||
// ].compactMap { $0 } | ||
// | ||
// openPanel.runModal() | ||
// | ||
// var url = openPanel.url | ||
// if url?.lastPathComponent.hasSuffix(".ash") == true { | ||
// url = url?.deletingLastPathComponent() | ||
// } | ||
// return url | ||
// } | ||
//} |
10 changes: 5 additions & 5 deletions
10
Modules/Features/GenerateFeature/Sources/GenerateFeature/FileURLs/LocalFileURLGetter.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import Foundation | ||
|
||
protocol LocalFileURLGetter { | ||
func getUrl() -> URL? | ||
} | ||
//import Foundation | ||
// | ||
//protocol LocalFileURLGetter { | ||
// func getUrl() -> URL? | ||
//} |
48 changes: 24 additions & 24 deletions
48
Modules/Features/GenerateFeature/Sources/GenerateFeature/FileURLs/XcodeProjURLGetter.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
import AppKit | ||
import Foundation | ||
|
||
struct XcodeProjURLGetter: LocalFileURLGetter { | ||
let fileURL: URL? | ||
|
||
func getUrl() -> URL? { | ||
let openPanel = NSOpenPanel() | ||
|
||
openPanel.directoryURL = fileURL?.deletingLastPathComponent() | ||
openPanel.allowsMultipleSelection = false | ||
openPanel.canChooseFiles = true | ||
openPanel.canChooseDirectories = false | ||
openPanel.canCreateDirectories = true | ||
openPanel.allowedContentTypes = [ | ||
.init(filenameExtension: "xcodeproj", | ||
conformingTo: .init("com.apple.package")!) | ||
].compactMap { $0 } | ||
|
||
openPanel.runModal() | ||
|
||
return openPanel.url | ||
} | ||
} | ||
//import AppKit | ||
//import Foundation | ||
// | ||
//struct XcodeProjURLGetter: LocalFileURLGetter { | ||
// let fileURL: URL? | ||
// | ||
// func getUrl() -> URL? { | ||
// let openPanel = NSOpenPanel() | ||
// | ||
// openPanel.directoryURL = fileURL?.deletingLastPathComponent() | ||
// openPanel.allowsMultipleSelection = false | ||
// openPanel.canChooseFiles = true | ||
// openPanel.canChooseDirectories = false | ||
// openPanel.canCreateDirectories = true | ||
// openPanel.allowedContentTypes = [ | ||
// .init(filenameExtension: "xcodeproj", | ||
// conformingTo: .init("com.apple.package")!) | ||
// ].compactMap { $0 } | ||
// | ||
// openPanel.runModal() | ||
// | ||
// return openPanel.url | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"macOSVersion" : "v12", | ||
"modules" : { | ||
"Contract" : "undefined", | ||
"Implementation" : "undefined" | ||
}, | ||
"name" : { | ||
"family" : "Provider", | ||
"given" : "LocalFileURL" | ||
}, | ||
"resources" : [ | ||
|
||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.2.2 | ||
4.3 |
7 changes: 7 additions & 0 deletions
7
...roviders/LocalFileURLProvider/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// swift-tools-version: 5.8 | ||
|
||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "LocalFileURLProvider", | ||
platforms: [ | ||
.macOS(.v12) | ||
], | ||
products: [ | ||
.library( | ||
name: "LocalFileURLProvider", | ||
targets: ["LocalFileURLProvider"]) | ||
], | ||
dependencies: [ | ||
.package(path: "../../Contracts/Providers/LocalFileURLProviderContract") | ||
], | ||
targets: [ | ||
.target( | ||
name: "LocalFileURLProvider", | ||
dependencies: [ | ||
"LocalFileURLProviderContract" | ||
] | ||
), | ||
.testTarget( | ||
name: "LocalFileURLProviderTests", | ||
dependencies: [ | ||
"LocalFileURLProvider" | ||
] | ||
) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# LocalFileURLProvider | ||
|
||
A description of this package. |
34 changes: 34 additions & 0 deletions
34
Modules/Providers/LocalFileURLProvider/Sources/LocalFileURLProvider/AshFileURLProvider.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import AppKit | ||
import Foundation | ||
import LocalFileURLProviderContract | ||
import UniformTypeIdentifiers | ||
|
||
public struct AshFileURLProvider: LocalFileURLProviderProtocol { | ||
let initialURL: URL? | ||
|
||
public init(initialURL: URL?) { | ||
self.initialURL = initialURL | ||
} | ||
|
||
public func localFileURL() -> URL? { | ||
let openPanel = NSOpenPanel() | ||
|
||
openPanel.directoryURL = initialURL?.deletingLastPathComponent() | ||
openPanel.allowsMultipleSelection = false | ||
openPanel.canChooseFiles = true | ||
openPanel.canChooseDirectories = true | ||
openPanel.canCreateDirectories = true | ||
openPanel.allowedContentTypes = [ | ||
.init(filenameExtension: "ash", | ||
conformingTo: .init("com.apple.package")!) | ||
].compactMap { $0 } | ||
|
||
openPanel.runModal() | ||
|
||
var url = openPanel.url | ||
if url?.lastPathComponent.hasSuffix(".ash") == true { | ||
url = url?.deletingLastPathComponent() | ||
} | ||
return url | ||
} | ||
} |
Oops, something went wrong.