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

webview demo do not work #2

Open
donaldtone opened this issue Feb 19, 2019 · 2 comments
Open

webview demo do not work #2

donaldtone opened this issue Feb 19, 2019 · 2 comments

Comments

@donaldtone
Copy link

donaldtone commented Feb 19, 2019

the error message shows that
'获取工程根路径异常!'

vscode:1.31
windows 7 sp1 professional

perhaps issue:
src/util.js
if (workspaceFolders.length == 1 && workspaceFolders[0] === vscode.workspace.rootPath) {

"vscode.workspace.rootPath" is deprecated.

@snoopylovefiona
Copy link

snoopylovefiona commented Apr 19, 2019

如果是windows系统,可以在util.js中添加如下代码:

workspaceFolders.forEach(folder => {
 // 应对windows系统下的文件路径异常问题
 folder = folder.replace(new RegExp("/","g"),'\').substring(1);
 if (currentFile.indexOf(folder) === 0) {
  projectPath = folder;
 }
})`
将路径分隔符替换掉就可以了

@luochang212
Copy link

如果是windows系统,可以在util.js中添加如下代码:

workspaceFolders.forEach(folder => {
 // 应对windows系统下的文件路径异常问题
 folder = folder.replace(new RegExp("/","g"),'').substring(1);
 if (currentFile.indexOf(folder) === 0) {
  projectPath = folder;
 }
})`
将路径分隔符替换掉就可以了

请问应该在文件中的什么位置啊?以及最后一个`符号为什么只有一个,不应该是成对出现的吗?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants