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

More standardized location for "last-checked" file #18

Closed
itamarst opened this issue Feb 2, 2022 · 5 comments · Fixed by #21
Closed

More standardized location for "last-checked" file #18

itamarst opened this issue Feb 2, 2022 · 5 comments · Fixed by #21

Comments

@itamarst
Copy link
Contributor

itamarst commented Feb 2, 2022

On the assumption that pip has done the relevant research correctly:

  1. For Unix-y systems, use "$XDG_CACHE_HOME/app-name" or fallback to "~/.cache/app-name". (https://github.com/pypa/pip/blob/dec279ecdf8fd2b0f984dd213198635fdbe320c7/src/pip/_vendor/platformdirs/unix.py#L86)
  2. For Windows, CSIDL_LOCAL_APPDATA (https://github.com/pypa/pip/blob/dec279ecdf8fd2b0f984dd213198635fdbe320c7/src/pip/_vendor/platformdirs/windows.py#L62)
  3. For macOS, "~/Library/Caches/app-name" (https://github.com/pypa/pip/blob/dec279ecdf8fd2b0f984dd213198635fdbe320c7/src/pip/_vendor/platformdirs/macos.py#L37).
@itamarst
Copy link
Contributor Author

itamarst commented Feb 3, 2022

https://docs.rs/app_dirs2/ or https://docs.rs/directories/ might have the right API to get this info.

@itamarst
Copy link
Contributor Author

itamarst commented Feb 5, 2022

Other problems with current naming scheme:

  1. A PyPI package might have same name as Crates package, but they will share same file on disk.
  2. In theory files could conflict with files from other tools.
  3. GitHub repos only use the name, not the owner, so namespace conflicts are possible (e.g. user1/fish and user2/fish would both be recorded as file with name fish).

My proposal, given cache dir obrained from app_dirs2 or the like: {cache_dir}/update-informer/{registry}-{owner}-{name}-{version} if owner is set, otherwise {cache_dir}/update-informer/{registry}-{name}-{version}.

@itamarst
Copy link
Contributor Author

itamarst commented Feb 5, 2022

Further reading: it seems the standards on Windows at least involve application developer, which is ... not something the library should set, I guess? So maybe that should be an input.

@itamarst
Copy link
Contributor Author

itamarst commented Feb 5, 2022

But... developer name can be optional with directories, at least.

@mgrachev
Copy link
Owner

My proposal, given cache dir obrained from app_dirs2 or the like: {cache_dir}/update-informer/{registry}-{owner}-{name}-{version} if owner is set, otherwise {cache_dir}/update-informer/{registry}-{name}-{version}.

Why did you decide to include the version to the file name?

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.

2 participants