From 18ff9587c383090ec9421ffcd952e851f368b938 Mon Sep 17 00:00:00 2001 From: Yoseph Maguire Date: Wed, 19 May 2021 09:57:13 -0700 Subject: [PATCH] normalize --- sdk/iot/modelsrepository/src/modelsRepositoryClient.ts | 4 ++-- sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts | 3 ++- sdk/iot/modelsrepository/src/utils/absolutePath.ts | 3 +++ .../modelsrepository/src/utils/fetcherFilesystem.browser.ts | 3 +++ sdk/iot/modelsrepository/src/utils/normalize.browser.ts | 6 ++++++ sdk/iot/modelsrepository/src/utils/normalize.ts | 4 ++++ 6 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 sdk/iot/modelsrepository/src/utils/normalize.browser.ts create mode 100644 sdk/iot/modelsrepository/src/utils/normalize.ts diff --git a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts index 174e7b87126e..afd5ce8031e3 100644 --- a/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts +++ b/sdk/iot/modelsrepository/src/modelsRepositoryClient.ts @@ -15,10 +15,10 @@ import { } from "./internal"; import * as cnst from "./constants"; import { createClientPipeline, InternalClientPipelineOptions } from "@azure/core-client"; -import * as path from "path"; import { Fetcher } from "./fetcherAbstract"; import { URL } from "./utils/url"; import { isLocalPath } from "./utils/absolutePath"; +import { normalize } from "./utils/normalize"; /** * Initializes a new instance of the IoT Models Repository Client. @@ -129,7 +129,7 @@ export class ModelsRepositoryClient { if (isLocalPath(location)) { // POSIX Filesystem Path or Windows Filesystem Path logger.info(`Repository location identified as filesystem path - using FilesystemFetcher`); - fetcher = new FilesystemFetcher(path.normalize(location)); + fetcher = new FilesystemFetcher(normalize(location)); } else { locationURL = new URL(location); const prot = locationURL.protocol; diff --git a/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts b/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts index 3a9592d2667a..79bec47376fd 100644 --- a/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts +++ b/sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts @@ -1,4 +1,5 @@ - +// Copyright (c) Microsoft. +// Licensed under the MIT license. export function isLocalPath() { return false; diff --git a/sdk/iot/modelsrepository/src/utils/absolutePath.ts b/sdk/iot/modelsrepository/src/utils/absolutePath.ts index 38eb9edb7133..6a11161348d6 100644 --- a/sdk/iot/modelsrepository/src/utils/absolutePath.ts +++ b/sdk/iot/modelsrepository/src/utils/absolutePath.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + import {isAbsolute} from "path"; export function isLocalPath(p: string): boolean { diff --git a/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts b/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts index 0fe0fce0061e..283d7b727fed 100644 --- a/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts +++ b/sdk/iot/modelsrepository/src/utils/fetcherFilesystem.browser.ts @@ -1,3 +1,6 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + export class FilesystemFetcher { constructor() { throw new Error("FilesystemFetcher is not supported in browser"); diff --git a/sdk/iot/modelsrepository/src/utils/normalize.browser.ts b/sdk/iot/modelsrepository/src/utils/normalize.browser.ts new file mode 100644 index 000000000000..eef26b31a8c1 --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/normalize.browser.ts @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +export function normalize(text: string) { + return text; +} \ No newline at end of file diff --git a/sdk/iot/modelsrepository/src/utils/normalize.ts b/sdk/iot/modelsrepository/src/utils/normalize.ts new file mode 100644 index 000000000000..66fee02c9d68 --- /dev/null +++ b/sdk/iot/modelsrepository/src/utils/normalize.ts @@ -0,0 +1,4 @@ +// Copyright (c) Microsoft. +// Licensed under the MIT license. + +export { normalize as normalize } from "path";