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

Change the default location for Enso projects #10318

Merged
merged 18 commits into from
Jun 22, 2024

Conversation

4e6
Copy link
Contributor

@4e6 4e6 commented Jun 19, 2024

Pull Request Description

close #10240

Changelog:

  • add: desktop-environment Java module to detect user environment configuration
  • add: ProjectsMigration module containing the migration logic of the enso projects directory
  • update: updated and cleaned up unused settings from the storage config
  • add: desktopEnvironment TS module to detect user environment configuration in the project-manager-shim
  • update: project-manager-shim with the new user projects directory

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • All code follows the
    Scala,
    Java,
    TypeScript,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • Unit tests have been written where possible.

@4e6 4e6 added the CI: No changelog needed Do not require a changelog entry for this PR. label Jun 19, 2024
@4e6 4e6 self-assigned this Jun 19, 2024
@4e6 4e6 marked this pull request as ready for review June 21, 2024 10:25
Copy link
Contributor

@somebody1234 somebody1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving changes to the PM shim used by GUI2's dev server

@@ -2791,6 +2792,17 @@ lazy val `benchmarks-common` =
)
.dependsOn(`polyglot-api`)

lazy val `desktop-environment` =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No 3rd party dependencies. I like such lightweight modules.

return DirectoriesFactory.getInstance();
}

public static String getOsName() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have to define the getOsName() method at all...

import org.enso.desktopenvironment.directories.Directories;
import org.enso.desktopenvironment.directories.DirectoriesFactory;

public final class Platform {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enum Platform {
  LINUX, MAC, WINDOWS
}

might be better choice from an API perspective.

@Override
public Path getDocuments() throws DirectoriesException {
try {
var process = new ProcessBuilder(PROCESS_REG_QUERY).start();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoiding a process execution would be nicer, but not even stack over flow has a suggestion how to do that nicely.

}

private Path getXdgDocuments() throws IOException, InterruptedException {
var process = new ProcessBuilder(PROCESS_XDG_DOCUMENTS).start();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for using xdg-user-dir I am looking forward for Enso to put the projects into the right directory on my Linux box!


import java.nio.file.Path;

public interface Directories {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you want other code outside of this module to implement this interface? If not, then prevent it:

  • (in old Java days) I'd recommend abstract class with package private constructor
  • now there is also an option to defined sealed interface

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good old Java days 🤠

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are you deleting this file? Are the reasons for its existence obsolete?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was added in #4098 as a dummy Java file to be able to open the project manager in IVG.

@4e6 4e6 added the CI: Ready to merge This PR is eligible for automatic merge label Jun 22, 2024
@mergify mergify bot merged commit ad5f2c9 into develop Jun 22, 2024
42 checks passed
@mergify mergify bot deleted the wip/db/10240-change-the-default-location-for-enso branch June 22, 2024 12:40
try {
return getXdgDocuments();
} catch (IOException | InterruptedException e) {
return getUserHome().resolve("enso");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log a warning about a fallback?

try {
return getUserHome().resolve(DOCUMENTS).toRealPath();
} catch (IOException e) {
throw new IOException("Failed to resolve real MacOs documents path", e);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why no fallback to whatever we have now?


return Path.of(stdoutParts[4].trim());
} catch (IOException e) {
throw new IOException("Failed to run Windows registry query", e);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No fallback?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change the default location for Enso project on Mac and Windows
4 participants