microsoft/vscode-react-native

Public

mirrored from https://github.com/microsoft/vscode-react-nativeAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
0.7.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

src/common/extensionMessaging.ts

18lines · modeblame

0502b7a8dlebu10 years ago1// Copyright (c) Microsoft Corporation. All rights reserved.
2// Licensed under the MIT license. See LICENSE file in the project root for details.
3
a1005420dlebu10 years ago4import {HostPlatform} from "./hostPlatform";
d3950d7edigeff10 years ago5import {Crypto} from "./node/crypto";
d40a8b0fdlebu10 years ago6
7daed3fcArtem Egorov8 years ago7export class MessagingHelper {
8public static getPath(projectRootPath: string): string {
d3950d7edigeff10 years ago9/* We need to use a different value for each VS Code window so the pipe names won't clash.
10We create the pipe path hashing the user id + project root path so both client and server
11will generate the same path, yet it's unique for each vs code instance */
12const userID = HostPlatform.getUserID();
7daed3fcArtem Egorov8 years ago13const normalizedRootPath = projectRootPath.toLowerCase();
19d78568Patricio Beltran10 years ago14const uniqueSeed = `${userID}:${normalizedRootPath}`;
d3950d7edigeff10 years ago15const hash = new Crypto().hash(uniqueSeed);
16return HostPlatform.getPipePath(`vscode-reactnative-${hash}`);
0502b7a8dlebu10 years ago17}
76c41138digeff10 years ago18}