Skip to content

Upload path resolves relative to binary location instead of working directory #637

@YuriiKot

Description

@YuriiKot

Problem

When using --upload, the path is resolved relative to the binary's location (std::env::current_exe()) rather than the current working directory. This makes it impossible to upload files unless they happen to be in the same directory as the gws binary (typically /usr/local/bin/).

Steps to reproduce

# From any directory
echo "test" > /tmp/test.png
gws drive files create --upload /tmp/test.png --json '{"name":"test.png","mimeType":"image/png"}'

Error:

--upload '/tmp/test.png' resolves to '/private/tmp/test.png' which is outside the current directory

Even absolute paths fail:

gws drive files create --upload /Users/me/documents/photo.png --json '{"name":"photo.png"}'
# Error: outside the current directory

The "current directory" in the error message is actually the binary's parent directory (/usr/local/bin/), not the shell's working directory.

Expected behavior

--upload should accept:

  • Absolute paths to any readable file
  • Relative paths resolved from the shell's current working directory (std::env::current_dir())

Current workaround

Copying the gws binary to a writable directory and placing upload files next to it, but not practical for team use.

Environment

  • gws 0.18.1
  • macOS (Apple Silicon)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions