@@ -435,22 +435,25 @@ async function createBootPropertiesFile() {
435435 const homeDir = hdbUtils . getHomeDir ( ) ;
436436 const homeDirPath = path . join ( homeDir , hdbTerms . HDB_HOME_DIR_NAME ) ;
437437 const homeDirKeysDirPath = path . join ( homeDirPath , hdbTerms . LICENSE_KEY_DIR_NAME ) ;
438-
439- try {
440- fs . mkdirpSync ( homeDirPath , { mode : hdbTerms . HDB_FILE_PERMISSIONS } ) ;
441- fs . mkdirpSync ( homeDirKeysDirPath , { mode : hdbTerms . HDB_FILE_PERMISSIONS } ) ;
442- } catch {
443- console . error (
444- `Could not make settings directory ${ hdbTerms . HDB_HOME_DIR_NAME } in home directory. Please check your permissions and try again.`
445- ) ;
446- }
447-
448438 const propsFilePath = path . join ( homeDirPath , hdbTerms . BOOT_PROPS_FILE_NAME ) ;
449- try {
450- await fs . writeFile ( propsFilePath , bootPropsValue ) ;
451- } catch ( err ) {
452- hdbLogger . error ( `There was an error creating the boot file at path: ${ propsFilePath } ` ) ;
453- throw err ;
439+ // if the properties file already exists, and we have an explicit ROOTPATH, we don't overwrite the existing
440+ // properties file
441+ if ( ! fs . existsSync ( propsFilePath ) || ! hdbUtils . getEnvCliRootPath ( ) ) {
442+ try {
443+ fs . mkdirpSync ( homeDirPath , { mode : hdbTerms . HDB_FILE_PERMISSIONS } ) ;
444+ fs . mkdirpSync ( homeDirKeysDirPath , { mode : hdbTerms . HDB_FILE_PERMISSIONS } ) ;
445+ } catch {
446+ console . error (
447+ `Could not make settings directory ${ hdbTerms . HDB_HOME_DIR_NAME } in home directory. Please check your permissions and try again.`
448+ ) ;
449+ }
450+
451+ try {
452+ await fs . writeFile ( propsFilePath , bootPropsValue ) ;
453+ } catch ( err ) {
454+ hdbLogger . error ( `There was an error creating the boot file at path: ${ propsFilePath } ` ) ;
455+ throw err ;
456+ }
454457 }
455458
456459 envManager . setProperty ( hdbTerms . HDB_SETTINGS_NAMES . INSTALL_USER , `${ install_user } ` ) ;
0 commit comments