Skip to content

Commit

Permalink
addon_folders.ts: assign scheme to URIs created for mockups (#147)
Browse files Browse the repository at this point in the history
Fix path read from setting `blender.addonFolders` when the path pointed to non-system drive on Windows.

* use vscode.Uri.from to load file to handle the path with schema correctly
* update dependencies

---------

Co-authored-by: Kiraa <kiraa@polygoniq.com>
Co-authored-by: Mateusz Grzeliński <grzelinskimat@gmail.com>
  • Loading branch information
3 people committed Sep 3, 2024
1 parent ecaa827 commit aa60b7e
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
- Remove duplicate links to development (VSCode) directory (#172)
- Remove broken links in addon and extension dir (#172)

### Changed
### Changed
- Updated dependencies. Now oldest supported VS Code version is `1.28.0` - version from September 2018. ([#147](https://github.com/JacquesLucke/blender_vscode/pull/147))
- Addon_update operator: Check more precisely which module to delete (#175)
- Formatted all python code with `black -l 120` (#167)
- Fix most of the user reported permission denied errors by changing python packages directory ([#177](https://github.com/JacquesLucke/blender_vscode/pull/177)):
Expand All @@ -25,6 +26,7 @@
- setting `blender.allowModifyExternalPython` is now deprecated ([#177](https://github.com/JacquesLucke/blender_vscode/pull/177))

### Fixed
- Path to addon indicated by [`blender.addonFolders`](vscode://settings/blender.addonFolders) now works correctly for non-system drive (usually `C:`) on Windows ([#147](https://github.com/JacquesLucke/blender_vscode/pull/147))
- Pinned requests to version 2.29 to maintain compatibility with blender 2.80 ([#177](https://github.com/JacquesLucke/blender_vscode/pull/177))
- Find correct python path for blender 2.92 and before (#174). This partly fixes compatibility with blender 2.80.
- "Blender: Run Script" will no longer open read-only file when hitting debug point (#142)
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -266,16 +266,15 @@
"scripts": {
"vscode:prepublish": "npm run compile",
"compile": "tsc -p ./",
"watch": "tsc -watch -p ./",
"postinstall": "node ./node_modules/vscode/bin/install"
"watch": "tsc -watch -p ./"
},
"devDependencies": {
"@types/mocha": "^2.2.42",
"@types/node": "^8.10.25",
"@types/request": "^2.48.1",
"@types/vscode": "^1.28.0",
"tslint": "^5.8.0",
"typescript": "^3.5.1",
"vscode": "^1.1.21"
"typescript": "^5.5.2"
},
"dependencies": {
"request": "^2.87.0"
Expand All @@ -284,4 +283,4 @@
"ms-python.python",
"ms-vscode.cpptools"
]
}
}
9 changes: 4 additions & 5 deletions src/addon_folder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ export class AddonWorkspaceFolder {
// search workspace folders instead.
let addonFolders = await foldersToWorkspaceFoldersMockup(
<string[]>getConfig().get('addonFolders'));
if (addonFolders.length === 0) {
addonFolders = getWorkspaceFolders();
}

let searchableFolders = addonFolders.length !== 0 ? addonFolders : getWorkspaceFolders();

let folders = [];
for (let folder of addonFolders) {
for (let folder of searchableFolders) {
let addon = new AddonWorkspaceFolder(folder);
if (await addon.hasAddonEntryPoint()) {
folders.push(addon);
Expand Down Expand Up @@ -166,7 +165,7 @@ async function foldersToWorkspaceFoldersMockup(folders: string[]) {

mockups.push({
"name" : path.basename(absolutePath),
"uri": vscode.Uri.parse(absolutePath),
"uri": vscode.Uri.from({ scheme: "file", path: absolutePath }),
"index": i
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export function handleErrors(func: () => Promise<void>) {
try {
await func();
}
catch (err) {
catch (err: any) {
if (err instanceof Error) {
if (err.message !== CANCEL) {
vscode.window.showErrorMessage(err.message);
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"target": "ES2020",
"outDir": "out",
"lib": [
"es6"
"es2020"
],
"sourceMap": true,
"rootDir": "src",
Expand Down

0 comments on commit aa60b7e

Please sign in to comment.