// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
// Copyright the Browserify authors. MIT License.

import { resolve } from "jsr:/@std/path@^0.224.0/resolve";
import { toPathString } from "./_to_path_string.ts";

/**
 * Test whether `src` and `dest` resolve to the same location
 * @param src src file path
 * @param dest dest file path
 */
export function isSamePath(
  src: string | URL,
  dest: string | URL,
): boolean | void {
  src = toPathString(src);
  dest = toPathString(dest);

  return resolve(src) === resolve(dest);
}

// denoCacheMetadata={"headers":{"set-cookie":"__cf_bm=RPWPsUwicIpdDhJc4HJDZv5KMf5YqW77azyGKKwY7tw-1785241875.2137985-1.0.1.1-xB7Y818AJx2OM4D3l2xaLkFT1btHUhvNdEqwfejeAPRns_gr7zlD5NlnP8Ok.hL81AYjUIWaZvN_dWNZ6KexT.v9Rhws2_ywgdoDG3hfQWtarblIn9Yru9nP5MVOH.IT; HttpOnly; SameSite=None; Secure; Path=/; Domain=jsr.io; Expires=Tue, 28 Jul 2026 13:01:15 GMT","content-security-policy":"default-src 'none'; script-src 'none'; style-src 'none'; img-src 'none'; font-src 'none'; connect-src 'none'; frame-src 'none'; object-src 'none'; frame-ancestors 'none'; sandbox; form-action 'none';","report-to":"{\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=F0oIE6ehxsbcl%2BNb6H%2F6Gvww8kTOdl8MzVqsdMms8IDU3AuOua02%2BUcdGdpbJdj%2FcWS3kzRqZPpqM16KCWTF5AFlpQ%2BeRBZxG%2Fm794IcSvM77CAoLoUFI5E%3D\"}]}","content-length":"558","etag":"\"016f24d2f32bc50921d77a7695fe0ac9\"","server":"cloudflare","access-control-expose-headers":"*","alt-svc":"h3=\":443\"; ma=86400","cf-cache-status":"HIT","vary":"Origin","access-control-allow-origin":"*","date":"Tue, 28 Jul 2026 12:31:15 GMT","x-jsr-backend":"modules","nel":"{\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}","accept-ranges":"bytes","age":"804698","cache-control":"public, max-age=31536000, immutable","x-content-type-options":"nosniff","cross-origin-resource-policy":"cross-origin","x-robots-tag":"noindex","content-type":"text/typescript","cf-ray":"a223e657fb4b7db6-LAX"},"url":"https://jsr.io/@std/fs/0.224.0/_is_same_path.ts","time":1785241875}