2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-12-21 07:39:51 +00:00
|
|
|
// Copyright the Browserify authors. MIT License.
|
|
|
|
|
2024-04-29 02:57:30 +00:00
|
|
|
import { resolve } from "@std/path/resolve";
|
2023-12-21 07:39:51 +00:00
|
|
|
import { toPathString } from "./_to_path_string.ts";
|
|
|
|
|
|
|
|
/**
|
2024-06-07 03:54:50 +00:00
|
|
|
* Checks if two paths are the same.
|
|
|
|
*
|
|
|
|
* @param src Source file path as a string or URL.
|
|
|
|
* @param dest Destination file path as a string or URL.
|
|
|
|
*
|
|
|
|
* @returns `true` if the paths are the same, `false` otherwise.
|
2023-12-21 07:39:51 +00:00
|
|
|
*/
|
|
|
|
export function isSamePath(
|
|
|
|
src: string | URL,
|
|
|
|
dest: string | URL,
|
2024-06-07 03:54:50 +00:00
|
|
|
): boolean {
|
2023-12-21 07:39:51 +00:00
|
|
|
src = toPathString(src);
|
|
|
|
dest = toPathString(dest);
|
|
|
|
|
|
|
|
return resolve(src) === resolve(dest);
|
|
|
|
}
|