Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use the open package to open files if the path contains non-ascii characters/ #54

Open
BlankSeed opened this issue Apr 10, 2023 · 5 comments
Labels
bug Something isn't working

Comments

@BlankSeed
Copy link

Description

I am using the package on Windows system. However, when non-ascii character exist in the file path, the input path breaks.

I noted that the js package 'open' could be used to do this when isElectronApp is set to false. So I installed the npm and the 'open' package from the windows command line. But nothing changed.

Is there anything I need to do to set the open package valid for this vscode extension? Thanks!

Extension Version

0.9.7

VS Code Version

Version: 1.77.1 (user setup)
Commit: b7886d7461186a5eac768481578c1d7ca80e2d21
Date: 2023-04-04T23:21:11.906Z
Electron: 19.1.11
Chromium: 102.0.5005.196
Node.js: 16.14.2
V8: 10.2.154.26-electron.0
OS: Windows_NT x64 10.0.19045
Sandboxed: Yes

Extension Settings

"openInExternalApp.openMapper": [

    {
        "extensionName": "doc",
        "apps": [
          {
            "title": "run word file",
            "isElectronApp": false,
            "shellCommand": "open ${file}"
          }
        ]
    },
],

Logs, Notifications, Screenshots, Screen Recording etc

Command failed: open c:\Users\Seed\Desktop\资料\文件1.doc
'open' �����ڲ����ⲿ���Ҳ���ǿ����еij���

@BlankSeed BlankSeed added the bug Something isn't working label Apr 10, 2023
@tjx666
Copy link
Owner

tjx666 commented Apr 10, 2023

直接配置:

"openInExternalApp.openMapper": [

    {
        "extensionName": "doc",
        "apps": [
          {
            "title": "run word file",
            "isElectronApp": false,
          }
        ]
    },
],

@tjx666
Copy link
Owner

tjx666 commented Apr 10, 2023

open 包不是 cli,你想用的是 https://github.com/sindresorhus/open-cli

@BlankSeed
Copy link
Author

直接配置:

"openInExternalApp.openMapper": [

    {
        "extensionName": "doc",
        "apps": [
          {
            "title": "run word file",
            "isElectronApp": false,
          }
        ]
    },
],

感谢回复

但这种情况下右键Open in external app后,output里面显示的opened file is: xxx,这个文件名是对的,但是实际没有文件打开,应该怎么处理呢

@tjx666
Copy link
Owner

tjx666 commented Apr 11, 2023

你是不是没有配置系统打开 doc 的默认应用,在文件管理器打开包含 doc 文件的文件夹,如果设置了的话文件会显示对应的图标

@BlankSeed
Copy link
Author

你是不是没有配置系统打开 doc 的默认应用,在文件管理器打开包含 doc 文件的文件夹,如果设置了的话文件会显示对应的图标

似乎不是这个原因,默认应用是设置了的,不过找到另一个方法供参考,这样看起来就可以打开非ASCII字符的文件了:

`"openInExternalApp.openMapper": [

{
    "extensionName": "doc",
    "apps": [
      {
        "title": "run word file",
        "isElectronApp": false,
        "shellCommand": "start \"\" \"${file}\""
      }
    ]
},

],`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants