Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to customize the data folder #13700

Closed
fanyipin opened this issue May 8, 2024 · 3 comments · Fixed by #13708
Closed

Failed to customize the data folder #13700

fanyipin opened this issue May 8, 2024 · 3 comments · Fixed by #13708
Assignees

Comments

@fanyipin
Copy link
Contributor

fanyipin commented May 8, 2024

Bug Description:

Prior to version 1.44, the ConfigDirUri variable could be customized via process.env.THEIA_CONFIG_DIR. This meant users could set process.env.THEIA_CONFIG_DIR within their application to specify a custom data directory. However, after the introduction of the logic in the app directory in version 1.44, process.env.THEIA_CONFIG_DIR is being re-assigned, which seems to override previous settings. I understand that there should be a priority order where:

  1. User-defined settings take precedence,
  2. Followed by application-specific settings if defined,
  3. Lastly, defaulting to the standard THEIA directory if neither is provided.

Here is the logical code for handling ConfigDirUri, which I understand should not be specified directly if process.env.THEIA_CONFIG_DIR has a value

protected async createConfigDirUri(): Promise<string> {
      const dataFolderPath = join(BackendApplicationPath, 'data');
      const userDataPath = join(dataFolderPath, 'user-data');
      const dataFolderExists = this.pathExistenceCache[dataFolderPath] ??= await pathExists(dataFolderPath);
      if (dataFolderExists) {
          const userDataExists = this.pathExistenceCache[userDataPath] ??= await pathExists(userDataPath);
          if (userDataExists) {
              process.env.THEIA_CONFIG_DIR = userDataPath;
          } else {
              await mkdir(userDataPath);
              process.env.THEIA_CONFIG_DIR = userDataPath;
              this.pathExistenceCache[userDataPath] = true;
          }
      } else {
          process.env.THEIA_CONFIG_DIR = join(homedir(), '.theia');
      }
      return FileUri.create(process.env.THEIA_CONFIG_DIR).toString();
  }

Steps to Reproduce:

if process.env.THEIA_CONFIG_DIR is specified as a directory, the latest cache file address is not matched

Additional Information

  • Operating System:
  • Theia Version: 1.44 ~1.49
@JonasHelming
Copy link
Contributor

@xai FYI

@fanyipin fanyipin changed the title Failed to customize the directory folder Failed to customize the data folder May 8, 2024
xai added a commit to eclipsesource/theia that referenced this issue May 13, 2024
Fixes eclipse-theia#13700

Contributed on behalf of STMicroelectronics

Signed-off-by: Olaf Lessenich <olessenich@eclipsesource.com>
@xai
Copy link
Contributor

xai commented May 13, 2024

@JonasHelming, please assign this issue to me (cannot self-assign). Thanks!

@xai
Copy link
Contributor

xai commented May 13, 2024

I understand that there should be a priority order where:

1. User-defined settings take precedence,

2. Followed by application-specific settings if defined,

3. Lastly, defaulting to the standard THEIA directory if neither is provided.

Thank you very much @fanyipin for raising this issue!

My understanding here is the same, so I opened PR #13708, which ensures the 1. property, that is currently violated.

msujew pushed a commit that referenced this issue May 15, 2024
Fixes #13700

Contributed on behalf of STMicroelectronics

Signed-off-by: Olaf Lessenich <olessenich@eclipsesource.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants