import { isRootOrDriveLetter, hasDriveLetter } from "./extpath.mjs";
import { Schemas } from "./network.mjs";
import { isWindows } from "./platform.mjs";
import { basename } from "./resources.mjs";
import { URI } from "./uri.mjs";
function getBaseLabel(resource) {
  if (!resource) {
    return void 0;
  }
  if (typeof resource === "string") {
    resource = URI.file(resource);
  }
  const base = basename(resource) || (resource.scheme === Schemas.file ? resource.fsPath : resource.path);
  if (isWindows && isRootOrDriveLetter(base)) {
    return normalizeDriveLetter(base);
  }
  return base;
}
function normalizeDriveLetter(path, continueAsWindows) {
  if (hasDriveLetter(path, continueAsWindows)) {
    return path.charAt(0).toUpperCase() + path.slice(1);
  }
  return path;
}
export {
  getBaseLabel,
  normalizeDriveLetter
};
