Skip to content

StatusLine Windows 環境下路徑反斜線的錯誤 #3

@WeiJ0

Description

@WeiJ0

在 Windows 環境下取得的路徑會是 \ ,搭配 printf %b 會被轉換成特殊指令
資料夾如果是 c.. b.. t.. 開頭都會被截止

Image

在路徑抓取上補上 gsub 取代反斜線就可以了

dir=$(echo "$input" | jq -r '(.workspace.current_dir // "") | gsub("\\\\"; "/")')

raw_dir=$(echo "$input" | jq -r '(.workspace.current_dir // "") | gsub("\\\\"; "/")')
Image

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