Skip to content

Commit

Permalink
Store .path in the FileInfo from lstat and stat
Browse files Browse the repository at this point in the history
  • Loading branch information
hayd authored Feb 14, 2019
1 parent 8d1567f commit b723ea3
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions js/stat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import { FileInfo, FileInfoImpl } from "./file_info";
* assert(fileInfo.isFile());
*/
export async function lstat(filename: string): Promise<FileInfo> {
return res(await dispatch.sendAsync(...req(filename, true)));
const f = await res(await dispatch.sendAsync(...req(filename, true)));
f.path = filename;
return f;
}

/** Queries the file system for information on the path provided synchronously.
Expand All @@ -23,7 +25,9 @@ export async function lstat(filename: string): Promise<FileInfo> {
* assert(fileInfo.isFile());
*/
export function lstatSync(filename: string): FileInfo {
return res(dispatch.sendSync(...req(filename, true)));
cosnt f = res(dispatch.sendSync(...req(filename, true)));

This comment has been minimized.

Copy link
@hayd

hayd Feb 14, 2019

Author Contributor

typo

f.path = filename;
return f;
}

/** Queries the file system for information on the path provided. `stat` Will
Expand All @@ -33,7 +37,9 @@ export function lstatSync(filename: string): FileInfo {
* assert(fileInfo.isFile());
*/
export async function stat(filename: string): Promise<FileInfo> {
return res(await dispatch.sendAsync(...req(filename, false)));
const f = await res(await dispatch.sendAsync(...req(filename, false)));
f.path = filename;
return f;
}

/** Queries the file system for information on the path provided synchronously.
Expand All @@ -43,7 +49,9 @@ export async function stat(filename: string): Promise<FileInfo> {
* assert(fileInfo.isFile());
*/
export function statSync(filename: string): FileInfo {
return res(dispatch.sendSync(...req(filename, false)));
const f = res(dispatch.sendSync(...req(filename, false)));
f.path = filename;
return f;
}

function req(
Expand Down

0 comments on commit b723ea3

Please sign in to comment.