@Bean("GlobalTempFolder")
  public TempFolder provide(ScannerProperties scannerProps, SonarUserHome userHome) {
    var workingPathName = StringUtils.defaultIfBlank(scannerProps.property(CoreProperties.GLOBAL_WORKING_DIRECTORY), CoreProperties.GLOBAL_WORKING_DIRECTORY_DEFAULT_VALUE);
    var workingPath = Paths.get(workingPathName);

    if (!workingPath.isAbsolute()) {
      var home = userHome.getPath();
      workingPath = home.resolve(workingPath).normalize();
    }
    try {
      cleanTempFolders(workingPath);
    } catch (IOException e) {
      LOG.error(String.format("failed to clean global working directory: %s", workingPath), e);
    }
    var tempDir = createTempFolder(workingPath);
    return new DefaultTempFolder(tempDir.toFile(), true);

  }
@Test
  void homeIsSymbolicLink(@TempDir Path realSonarHome, @TempDir Path symlink) throws IOException {
    assumeTrue(!System2.INSTANCE.isOsWindows());
    symlink.toFile().delete();
    Files.createSymbolicLink(symlink, realSonarHome);
    when(sonarUserHome.getPath()).thenReturn(symlink);

    ScannerProperties globalProperties = new ScannerProperties(Map.of());

    TempFolder tempFolder = underTest.provide(globalProperties, sonarUserHome);
    File newFile = tempFolder.newFile();
    assertThat(newFile.getParentFile().getParentFile().toPath().toAbsolutePath()).isEqualTo(symlink);
    assertThat(newFile.getParentFile().getName()).startsWith(".sonartmp_");
  }