File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 1
1
import * as path from 'path' ;
2
2
import { OVERRIDES_DIR } from './interceptors/terminal/terminal-env-overrides' ;
3
3
4
- import { deleteFile , writeFile } from "./util/fs" ;
4
+ import { deleteFile , mkDir , writeFile } from "./util/fs" ;
5
5
6
6
export const WEBEXTENSION_PATH = path . join ( OVERRIDES_DIR , 'webextension' ) ;
7
+ const WEBEXTENSION_CONFIG_PATH = path . join ( WEBEXTENSION_PATH , 'config' ) ;
7
8
8
9
interface WebExtensionConfig { // Should match config in the WebExtension itself
9
10
mockRtc : {
@@ -16,7 +17,7 @@ const getConfigKey = (proxyPort: number) =>
16
17
`127_0_0_1.${ proxyPort } ` ; // Filename-safe proxy address
17
18
18
19
const getConfigPath = ( proxyPort : number ) =>
19
- path . join ( WEBEXTENSION_PATH , 'config' , getConfigKey ( proxyPort ) ) ;
20
+ path . join ( WEBEXTENSION_CONFIG_PATH , getConfigKey ( proxyPort ) ) ;
20
21
21
22
export function clearWebExtensionConfig ( httpProxyPort : number ) {
22
23
return deleteFile ( getConfigPath ( httpProxyPort ) )
@@ -42,5 +43,6 @@ export async function updateWebExtensionConfig(
42
43
}
43
44
44
45
async function writeConfig ( proxyPort : number , config : WebExtensionConfig ) {
46
+ await mkDir ( WEBEXTENSION_CONFIG_PATH ) . catch ( ( ) => { } ) ; // Make sure the config dir exists
45
47
return writeFile ( getConfigPath ( proxyPort ) , JSON . stringify ( config ) ) ;
46
48
}
You can’t perform that action at this time.
0 commit comments