Skip to content

Commit

Permalink
fix copyTo path
Browse files Browse the repository at this point in the history
  • Loading branch information
manyuanrong committed Mar 4, 2020
1 parent 6a5fefd commit ebaf7c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
7 changes: 5 additions & 2 deletions build.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import { existsSync } from "https://deno.land/std/fs/exists.ts";
import { resolve } from "https://deno.land/std/path/mod.ts";
import { resolve, extname } from "https://deno.land/std/path/mod.ts";

export async function copyTargets() {
await Deno.mkdir(".deno_plugins", { recursive: true });
const targets = ["libdeno_mongo.dylib", "libdeno_mongo.so", "deno_mongo.dll"];
for (const target of targets) {
const targetPath = resolve("./target/release", target);
const targetToPath = resolve(".deno_plugins", target);
const targetToPath = resolve(
".deno_plugins",
`deno_mongo${extname(target)}`
);
if (existsSync(targetPath)) {
console.log(`Copy "${targetPath}" to "${targetToPath}"`);
await Deno.copyFile(targetPath, targetToPath);
Expand Down
2 changes: 1 addition & 1 deletion test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ test(async function testDeleteOne() {
});

await cargoBuild();
await init();
await init("master");
await runTests();
5 changes: 2 additions & 3 deletions ts/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ interface Command {
command_id?: number;
}

export async function init() {
let releaseUrl =
"https://github.com/manyuanrong/deno_mongo/releases/download/master";
export async function init(binVer: string = "master") {
let releaseUrl = `https://github.com/manyuanrong/deno_mongo/releases/download/${binVer}`;

const options = {
name: PLUGIN_NAME,
Expand Down

0 comments on commit ebaf7c4

Please sign in to comment.