mirror of
https://github.com/denoland/deno.git
synced 2024-11-23 15:16:54 -05:00
parent
16e52ee4b0
commit
7c4e973611
4 changed files with 13 additions and 10 deletions
|
@ -1,5 +1,5 @@
|
|||
variables:
|
||||
DENO_VERSION: "v0.5.0"
|
||||
DENO_VERSION: "v0.6.0"
|
||||
TS_VERSION: "3.4.5"
|
||||
|
||||
# TODO DRY up the jobs
|
||||
|
|
|
@ -145,7 +145,7 @@ async function copyDir(
|
|||
const files = await Deno.readDir(src);
|
||||
|
||||
for (const file of files) {
|
||||
const srcPath = file.path as string;
|
||||
const srcPath = path.join(src, file.name);
|
||||
const destPath = path.join(dest, path.basename(srcPath as string));
|
||||
if (file.isDirectory()) {
|
||||
await copyDir(srcPath, destPath, options);
|
||||
|
@ -173,7 +173,7 @@ function copyDirSync(src: string, dest: string, options: CopyOptions): void {
|
|||
const files = Deno.readDirSync(src);
|
||||
|
||||
for (const file of files) {
|
||||
const srcPath = file.path as string;
|
||||
const srcPath = path.join(src, file.name);
|
||||
const destPath = path.join(dest, path.basename(srcPath as string));
|
||||
if (file.isDirectory()) {
|
||||
copyDirSync(srcPath, destPath, options);
|
||||
|
|
|
@ -16,8 +16,9 @@ export async function emptyDir(dir: string): Promise<void> {
|
|||
}
|
||||
while (items.length) {
|
||||
const item = items.shift();
|
||||
if (item && item.path) {
|
||||
await Deno.remove(item.path, { recursive: true });
|
||||
if (item && item.name) {
|
||||
const fn = dir + "/" + item.name;
|
||||
Deno.remove(fn, { recursive: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,8 +40,9 @@ export function emptyDirSync(dir: string): void {
|
|||
}
|
||||
while (items.length) {
|
||||
const item = items.shift();
|
||||
if (item && item.path) {
|
||||
Deno.removeSync(item.path, { recursive: true });
|
||||
if (item && item.name) {
|
||||
const fn = dir + "/" + item.name;
|
||||
Deno.removeSync(fn, { recursive: true });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -149,19 +149,20 @@ async function serveDir(
|
|||
const listEntry: string[] = [];
|
||||
const fileInfos = await readDir(dirPath);
|
||||
for (const info of fileInfos) {
|
||||
let fn = dirPath + "/" + info.name;
|
||||
if (info.name === "index.html" && info.isFile()) {
|
||||
// in case index.html as dir...
|
||||
return await serveFile(req, info.path);
|
||||
return await serveFile(req, fn);
|
||||
}
|
||||
// Yuck!
|
||||
let mode = null;
|
||||
try {
|
||||
mode = (await stat(info.path)).mode;
|
||||
mode = (await stat(fn)).mode;
|
||||
} catch (e) {}
|
||||
listEntry.push(
|
||||
createDirEntryDisplay(
|
||||
info.name,
|
||||
dirName + "/" + info.name,
|
||||
fn,
|
||||
info.isFile() ? info.len : null,
|
||||
mode,
|
||||
info.isDirectory()
|
||||
|
|
Loading…
Reference in a new issue