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

Makes GitLens XDG-compatible #3904

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nzaytsev
Copy link
Contributor

@nzaytsev nzaytsev commented Dec 23, 2024

Description

All new installs files will be placed into platform specific folder

  • Linux: $XDG_DATA_HOME/gk (~/.local/share/gk)
  • Windows: %LOCALAPPDATA%/gk/Data (C:\Users<user>\AppData\Local\gk\Data)
  • MacOS: ~/Library/Application Support/gk

Existing installs are used $HOME.gk directory. It can be changed manually by deleting .gk directory or moving to corresponding directory

https://github.com/sindresorhus/env-paths/tree/main could be used instead, it implements the logic

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

@nzaytsev nzaytsev linked an issue Dec 23, 2024 that may be closed by this pull request
}

// export as a singleton
// eslint-disable-next-line import-x/no-default-export
export default new SharedGKDataFolderMapper();
Copy link
Member

Choose a reason for hiding this comment

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

Don't use a default export

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@nzaytsev nzaytsev force-pushed the debt/3660-gitlens-creates-a-gk-folder-in-the-home-dir branch from 5f1a57e to 75caad1 Compare December 24, 2024 02:59
@nzaytsev nzaytsev force-pushed the debt/3660-gitlens-creates-a-gk-folder-in-the-home-dir branch from 75caad1 to 3d08906 Compare December 24, 2024 04:20
Copy link
Contributor

@axosoft-ramint axosoft-ramint left a comment

Choose a reason for hiding this comment

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

Works for me, just a few minor comments and suggestions.

} catch {
// File does not exist, so we can safely create it
break;
// Path does not exist, so we can safely use xdg paths it
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Path does not exist, so we can safely use xdg paths it
// Path does not exist, so we can safely use xdg paths

break;
// Path does not exist, so we can safely use xdg paths it
const platform = getPlatform();
const folderName = 'gk';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be GitKraken? Would follow a better convention perhaps with the rest of folders in places like AppData/Local. Thoughts @eamodio ?

Copy link
Member

Choose a reason for hiding this comment

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

I think we should follow the exact convention of the current folder name/structure -- just in a different location

class SharedGKDataFolderMapper {
private _initPromise: Promise<void> | undefined;
constructor(
// do soft migration, use new folders only for new users (without existing folders)
Copy link
Contributor

Choose a reason for hiding this comment

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

We may want to inform users who have a .gk folder, and want to use the new location, like many of the users in the original issue, that they should delete the former. Otherwise GitLens will continue using it.

In fact, they may want to take the contents out of that folder, delete it, and then move it into the new XDG-friendly folder so they don't lose the data.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, probably in the help center and on the issue, but I wouldn't say in the app

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 this pull request may close these issues.

GitLens creates a .gk folder in the home dir.
4 participants