Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Commit

Permalink
check for https://, file:// and /template when creating new pro…
Browse files Browse the repository at this point in the history
…ject (#62)
  • Loading branch information
RandomFractals committed Jun 4, 2023
1 parent 7a69dd8 commit de643ad
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/commands/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { getFileUri } from '../extensionContext';
/**
* Default Evidence template project url.
*/
const defaultTemplateProjectUrl = '../../template';
const defaultTemplateProjectUrl: string = '../../template';

/**
* Evidence template project Url setting name.
Expand Down Expand Up @@ -75,12 +75,14 @@ export async function createNewProject(projectFolder?: Uri) {
const templateProjectUrl = <string>getConfig('templateProjectUrl', defaultTemplateProjectUrl);
const projectTemplateUrl = templateProjectUrl;

if (projectTemplateUrl.startsWith(gitHubUrlBase)) {
// clone Evidence template project from a github repository
if (projectTemplateUrl.startsWith('https://')) {
// attemplt to clone an Evidence template project from a github repository
// into the selected new Evidence project folder
await cloneTemplateRepository(projectTemplateUrl, projectFolderPath);
}
else if (projectTemplateUrl === defaultTemplateProjectUrl) {
else if (projectTemplateUrl.startsWith('file://') &&
(projectTemplateUrl === defaultTemplateProjectUrl ||
projectTemplateUrl === '/template') ) {
// get embedded /template folder Uri from extension context
const templateFolder: Uri = getFileUri(defaultTemplateProjectUrl);

Expand Down

0 comments on commit de643ad

Please sign in to comment.