Skip to content

Commit

Permalink
normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
YoDaMa committed May 19, 2021
1 parent 3393208 commit 18ff958
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions sdk/iot/modelsrepository/src/modelsRepositoryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
Expand Down
3 changes: 2 additions & 1 deletion sdk/iot/modelsrepository/src/utils/aboslutePath.browser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@

// Copyright (c) Microsoft.
// Licensed under the MIT license.

export function isLocalPath() {
return false;
Expand Down
3 changes: 3 additions & 0 deletions sdk/iot/modelsrepository/src/utils/absolutePath.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) Microsoft.
// Licensed under the MIT license.

import {isAbsolute} from "path";

export function isLocalPath(p: string): boolean {
Expand Down
Original file line number Diff line number Diff line change
@@ -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");
Expand Down
6 changes: 6 additions & 0 deletions sdk/iot/modelsrepository/src/utils/normalize.browser.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// Copyright (c) Microsoft.
// Licensed under the MIT license.

export function normalize(text: string) {
return text;
}
4 changes: 4 additions & 0 deletions sdk/iot/modelsrepository/src/utils/normalize.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (c) Microsoft.
// Licensed under the MIT license.

export { normalize as normalize } from "path";

0 comments on commit 18ff958

Please sign in to comment.