mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
refactor(fs): fix uncaught errors in browsers (#6135)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
This commit is contained in:
parent
e3974eae69
commit
c0427a02bb
@ -8,7 +8,8 @@ import { getFileInfoType } from "./_get_file_info_type.ts";
|
|||||||
import { toPathString } from "./_to_path_string.ts";
|
import { toPathString } from "./_to_path_string.ts";
|
||||||
import { isSubdir } from "./_is_subdir.ts";
|
import { isSubdir } from "./_is_subdir.ts";
|
||||||
|
|
||||||
const isWindows = Deno.build.os === "windows";
|
// deno-lint-ignore no-explicit-any
|
||||||
|
const isWindows = (globalThis as any).Deno?.build.os === "windows";
|
||||||
|
|
||||||
/** Options for {@linkcode copy} and {@linkcode copySync}. */
|
/** Options for {@linkcode copy} and {@linkcode copySync}. */
|
||||||
export interface CopyOptions {
|
export interface CopyOptions {
|
||||||
|
@ -5,7 +5,8 @@ import { ensureDir, ensureDirSync } from "./ensure_dir.ts";
|
|||||||
import { getFileInfoType, type PathType } from "./_get_file_info_type.ts";
|
import { getFileInfoType, type PathType } from "./_get_file_info_type.ts";
|
||||||
import { toPathString } from "./_to_path_string.ts";
|
import { toPathString } from "./_to_path_string.ts";
|
||||||
|
|
||||||
const isWindows = Deno.build.os === "windows";
|
// deno-lint-ignore no-explicit-any
|
||||||
|
const isWindows = (globalThis as any).Deno?.build.os === "windows";
|
||||||
|
|
||||||
function resolveSymlinkTarget(target: string | URL, linkName: string | URL) {
|
function resolveSymlinkTarget(target: string | URL, linkName: string | URL) {
|
||||||
if (typeof target !== "string") return target; // URL is always absolute path
|
if (typeof target !== "string") return target; // URL is always absolute path
|
||||||
|
@ -16,7 +16,9 @@ export const CRLF = "\r\n" as const;
|
|||||||
* EOL; // "\n" on POSIX platforms and "\r\n" on Windows
|
* EOL; // "\n" on POSIX platforms and "\r\n" on Windows
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export const EOL: "\n" | "\r\n" = Deno?.build.os === "windows" ? CRLF : LF;
|
export const EOL: "\n" | "\r\n" =
|
||||||
|
// deno-lint-ignore no-explicit-any
|
||||||
|
(globalThis as any).Deno?.build.os === "windows" ? CRLF : LF;
|
||||||
|
|
||||||
const regDetect = /(?:\r?\n)/g;
|
const regDetect = /(?:\r?\n)/g;
|
||||||
|
|
||||||
|
@ -15,7 +15,8 @@ import {
|
|||||||
|
|
||||||
export type { GlobOptions, WalkEntry };
|
export type { GlobOptions, WalkEntry };
|
||||||
|
|
||||||
const isWindows = Deno.build.os === "windows";
|
// deno-lint-ignore no-explicit-any
|
||||||
|
const isWindows = (globalThis as any).Deno?.build.os === "windows";
|
||||||
|
|
||||||
/** Options for {@linkcode expandGlob} and {@linkcode expandGlobSync}. */
|
/** Options for {@linkcode expandGlob} and {@linkcode expandGlobSync}. */
|
||||||
export interface ExpandGlobOptions extends Omit<GlobOptions, "os"> {
|
export interface ExpandGlobOptions extends Omit<GlobOptions, "os"> {
|
||||||
|
Loading…
Reference in New Issue
Block a user