Skip to content

Use os.path instead of ntpath to improve cross-platform compatibility #275

@jacopotediosi

Description

@jacopotediosi

This project currently uses the ntpath module for path manipulations. While this works in many cases, ntpath is specific to Windows and may result in incorrect behavior on non-Windows platforms such as Linux or macOS.

The os.path module automatically selects the appropriate path implementation for the current operating system (ntpath on Windows, posixpath on Unix-like systems), making it the preferred choice for cross-platform compatibility.

Unless there is a specific need for Windows-style path handling, I recommend replacing all occurrences of ntpath in utilities.py with os.path, especially considering that OctoPrint is most commonly used on Linux-based systems like Raspberry Pi (OctoPi).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions