Skip to content

Commit 6601330

Browse files
committed
Added swift dev toolchain detection
Signed-off-by: paulober <[email protected]>
1 parent 29726cf commit 6601330

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

src/utils/swiftUtil.mts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import { promisify } from "util";
44
const execAsync = promisify(exec);
55

66
export default async function checkSwiftRequirements(): Promise<boolean> {
7-
return true;
8-
// check if swift is installed
97
try {
10-
await execAsync("swift --version");
8+
const result = await execAsync("swift --version");
119

12-
// TODO: check swift version
10+
if (!result.stdout.includes("-dev")) {
11+
return false;
12+
}
1313

1414
return true;
15-
} catch (error) {
15+
} catch {
1616
return false;
1717
}
1818
}

src/webview/newProjectPanel.mts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1283,14 +1283,16 @@ export class NewProjectPanel {
12831283
});
12841284
void window
12851285
.showErrorMessage(
1286-
"Swift is required for Swift project generation. Please install Swift.",
1287-
"Install"
1286+
"Swift dev snapshot is required for Swift project generation. Please install the latest downloadable 'main' Swift Development Snapshot from swift.org to use Embedded Swift.",
1287+
"Open instructions (section 1-2 only)"
12881288
)
12891289
.then(selected => {
12901290
if (selected) {
12911291
env.openExternal(
1292-
// TODO: check url
1293-
Uri.parse("https://swift.org/download/#releases")
1292+
//Uri.parse("https://swift.org/download/#releases")
1293+
Uri.parse(
1294+
"https://apple.github.io/swift-matter-examples/tutorials/swiftmatterexamples/setup-macos/"
1295+
)
12941296
);
12951297
}
12961298
});
@@ -1691,6 +1693,7 @@ export class NewProjectPanel {
16911693
// Restrict the webview to only load specific scripts
16921694
const nonce = getNonce();
16931695
const isWindows = process.platform === "win32";
1696+
const isMacOS = process.platform === "darwin";
16941697

16951698
// Get the default values from global state
16961699
const useProjectNameAsEntryPointFileName =
@@ -2196,7 +2199,7 @@ export class NewProjectPanel {
21962199
</div>
21972200
</li>
21982201
${
2199-
!isWindows
2202+
isMacOS
22002203
? `
22012204
<li class="w-full border-b border-gray-200 sm:border-b-0 sm:border-r dark:border-gray-600">
22022205
<div class="flex items-center pl-3">

0 commit comments

Comments
 (0)