Skip to content

get_configs_local_store: path-vs-app-name detection sniffs os.path.sep (split from #16, item 7) #28

Description

@thorwhalen

Split out of #16 (item 7).

Problem

config2py/tools.py get_configs_local_store decides "folder path vs app name" with os.path.sep in config_src. Consequences:

  • An existing relative directory without a separator (e.g. "configs") is treated as an app name, and a folder ~/.config/configs/configs is created instead.
  • On Windows, where os.path.sep == "\\", a forward-slash path such as "C:/work/configs" is also treated as an app name.

Why this was not changed here

The Windows half cannot be tested in a Linux cloud VM, and changing the classification of existing inputs moves where dependents read and write their configs. Labelled needs-local.

Proposed plan

  1. Treat config_src as a path when it is a pathlib.Path, or os.path.isabs(config_src), or it contains os.sep or os.altsep. Keep plain names as app names.
  2. Optionally add a keyword-only kind: Literal["auto", "path", "app"] = "auto" for explicitness.
  3. Tests: Path inputs, absolute paths, altsep handling (run on Windows CI via test_on_windows), and the current behaviour for bare names unchanged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions