Skip to content

Improve Cross-Platform Path Handling for Unity Project Operations #19

Open
@MtMath

Description

@MtMath

Description

Currently, the library may not fully handle path differences across operating systems when working with Unity project paths. This can lead to inconsistent behavior when using methods like openProject, createProject, and other file-system operations across Windows, macOS, and Linux.

Problem

When working with Unity projects on different operating systems, path separators and environment-specific path handling can cause issues:

  • Windows uses backslashes (\) while Unix-based systems use forward slashes (/)
  • Special folder paths like AppData are platform-specific
  • The Unity Hub and Unity Editor may have different path conventions on each platform

Proposed Changes

  1. Implement robust path normalization throughout the codebase
  2. Create platform-specific path handling utilities in a dedicated module
  3. Add automatic path separator conversion for cross-platform compatibility
  4. Improve error messages related to path issues with platform-specific guidance
  5. Add tests that verify functionality across simulated platform environments

Benefits

  • More reliable operation across all supported platforms
  • Reduced user error and confusion when using the library on different operating systems
  • Improved developer experience through consistent path handling APIs

Implementation Notes

  • Consider using Node.js path module more extensively
  • Add platform detection utilities beyond the current automatic detection
  • Document platform-specific considerations in the README and code comments
  • Create examples showing proper path usage for each operating system

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