1- import * as path from "path" ;
1+ import * as path from "node: path" ;
22import * as vscode from "vscode" ;
33
44export class PathResolver {
@@ -8,26 +8,28 @@ export class PathResolver {
88 ) { }
99
1010 /**
11- * Return the directory for the deployment with the provided label to where
12- * the global Coder configs are stored.
11+ * Return the directory for the deployment with the provided hostname to
12+ * where the global Coder configs are stored.
1313 *
14- * If the label is empty, read the old deployment-unaware config instead.
14+ * If the hostname is empty, read the old deployment-unaware config instead.
1515 *
1616 * The caller must ensure this directory exists before use.
1717 */
18- public getGlobalConfigDir ( label : string ) : string {
19- return label ? path . join ( this . basePath , label ) : this . basePath ;
18+ public getGlobalConfigDir ( safeHostname : string ) : string {
19+ return safeHostname
20+ ? path . join ( this . basePath , safeHostname )
21+ : this . basePath ;
2022 }
2123
2224 /**
23- * Return the directory for a deployment with the provided label to where its
24- * binary is cached.
25+ * Return the directory for a deployment with the provided hostname to where
26+ * its binary is cached.
2527 *
26- * If the label is empty, read the old deployment-unaware config instead.
28+ * If the hostname is empty, read the old deployment-unaware config instead.
2729 *
2830 * The caller must ensure this directory exists before use.
2931 */
30- public getBinaryCachePath ( label : string ) : string {
32+ public getBinaryCachePath ( safeHostname : string ) : string {
3133 const settingPath = vscode . workspace
3234 . getConfiguration ( )
3335 . get < string > ( "coder.binaryDestination" )
@@ -36,7 +38,7 @@ export class PathResolver {
3638 settingPath || process . env . CODER_BINARY_DESTINATION ?. trim ( ) ;
3739 return binaryPath
3840 ? path . normalize ( binaryPath )
39- : path . join ( this . getGlobalConfigDir ( label ) , "bin" ) ;
41+ : path . join ( this . getGlobalConfigDir ( safeHostname ) , "bin" ) ;
4042 }
4143
4244 /**
@@ -69,39 +71,39 @@ export class PathResolver {
6971 }
7072
7173 /**
72- * Return the directory for the deployment with the provided label to where
73- * its session token is stored.
74+ * Return the directory for the deployment with the provided hostname to
75+ * where its session token is stored.
7476 *
75- * If the label is empty, read the old deployment-unaware config instead.
77+ * If the hostname is empty, read the old deployment-unaware config instead.
7678 *
7779 * The caller must ensure this directory exists before use.
7880 */
79- public getSessionTokenPath ( label : string ) : string {
80- return path . join ( this . getGlobalConfigDir ( label ) , "session" ) ;
81+ public getSessionTokenPath ( safeHostname : string ) : string {
82+ return path . join ( this . getGlobalConfigDir ( safeHostname ) , "session" ) ;
8183 }
8284
8385 /**
84- * Return the directory for the deployment with the provided label to where
85- * its session token was stored by older code.
86+ * Return the directory for the deployment with the provided hostname to
87+ * where its session token was stored by older code.
8688 *
87- * If the label is empty, read the old deployment-unaware config instead.
89+ * If the hostname is empty, read the old deployment-unaware config instead.
8890 *
8991 * The caller must ensure this directory exists before use.
9092 */
91- public getLegacySessionTokenPath ( label : string ) : string {
92- return path . join ( this . getGlobalConfigDir ( label ) , "session_token" ) ;
93+ public getLegacySessionTokenPath ( safeHostname : string ) : string {
94+ return path . join ( this . getGlobalConfigDir ( safeHostname ) , "session_token" ) ;
9395 }
9496
9597 /**
96- * Return the directory for the deployment with the provided label to where
97- * its url is stored.
98+ * Return the directory for the deployment with the provided hostname to
99+ * where its url is stored.
98100 *
99- * If the label is empty, read the old deployment-unaware config instead.
101+ * If the hostname is empty, read the old deployment-unaware config instead.
100102 *
101103 * The caller must ensure this directory exists before use.
102104 */
103- public getUrlPath ( label : string ) : string {
104- return path . join ( this . getGlobalConfigDir ( label ) , "url" ) ;
105+ public getUrlPath ( safeHostname : string ) : string {
106+ return path . join ( this . getGlobalConfigDir ( safeHostname ) , "url" ) ;
105107 }
106108
107109 /**
0 commit comments