1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00
lens/src/common/register-protocol.ts
Panu Horsmalahti ae7b3c0da2 Add eslint rule padding-line-between-statements
Signed-off-by: Panu Horsmalahti <phorsmalahti@mirantis.com>
2020-12-02 09:17:12 +02:00

14 lines
383 B
TypeScript

// Register custom protocols
import { protocol } from "electron";
import path from "path";
export function registerFileProtocol(name: string, basePath: string) {
protocol.registerFileProtocol(name, (request, callback) => {
const filePath = request.url.replace(`${name}://`, "");
const absPath = path.resolve(basePath, filePath);
callback({ path: absPath });
});
}