Skip to content

Storage default D:/Gently3 is non-portable — creates a stray relative D: dir off-Windows #56

Description

@subindevs

Problem

StorageSettings.base_path defaults to a Windows drive path:

# gently/settings.py:73
base_path: Path = field(default_factory=lambda: _env("STORAGE_PATH", Path("D:/Gently3")))

On Windows (the microscope PCs) this is correct — D: is the dedicated data drive. But off-Windows (Linux dev boxes, macOS, CI), Path("D:/Gently3") is not an absolute path. It resolves relative to the cwd, so a default-config run silently creates a junk directory literally named D: and writes session data into it.

PR #51 added D:/ to .gitignore, which hides the symptom but doesn't stop the app from writing to a nonsense location.

Actual fix

Make the default platform-aware so Windows is untouched and everywhere else gets a real absolute path:

def _default_storage_path() -> Path:
    if os.name == "nt":
        return Path("D:/Gently3")
    xdg = os.environ.get("XDG_DATA_HOME")
    base = Path(xdg) if xdg else Path.home() / ".local" / "share"
    return base / "Gently3"

# ...
base_path: Path = field(default_factory=lambda: _env("STORAGE_PATH", _default_storage_path()))
  • Windows production behavior is identical.
  • GENTLY_STORAGE_PATH override is unchanged.
  • The .gitignore D:/ entry becomes unnecessary (can be left as a stopgap).

Out of scope / follow-up

Other hardcoded D:/... defaults exist in legacy/script modules and could later route through settings.storage.base_path:

  • gently/dataset/aggregator.py, embryo_dataset.py:164, schema.py:24 (DEFAULT_DB_PATH)
  • benchmarks/perception/runner.py:493, diagnostics/segment_embryo_nuclei.py:57

Notes

Behavior change on non-Windows defaults → land as its own PR against development, not folded into release #51.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions