Skip to content

Commit

Permalink
test changes
Browse files Browse the repository at this point in the history
  • Loading branch information
strike-digital committed Jul 4, 2024
1 parent 664dc4d commit e168567
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 5 deletions.
10 changes: 9 additions & 1 deletion pythonFiles/include/blender_vscode/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,13 @@

version = bpy.app.version
scripts_folder = blender_path.parent / f"{version[0]}.{version[1]}" / "scripts"
user_addon_directory = Path(bpy.utils.user_resource('SCRIPTS', path="addons"))


def get_user_addon_directory(source_path: Path):
if version >= (4, 2, 0) and next(source_path.glob("blender_manifest.toml"), None):
return Path(bpy.utils.user_resource("EXTENSIONS", path="user_default"))
else:
return Path(bpy.utils.user_resource('SCRIPTS', path="addons"))


addon_directories = tuple(map(Path, addon_utils.paths()))
13 changes: 12 additions & 1 deletion pythonFiles/include/blender_vscode/load_addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,20 @@
import traceback
from pathlib import Path
from . communication import send_dict_as_json
from . environment import user_addon_directory, addon_directories
from . environment import get_user_addon_directory, addon_directories


def setup_addon_links(addons_to_load):

user_addon_directory = get_user_addon_directory(Path(next(addons_to_load.keys())))
print(f"USER ADDON: {user_addon_directory}")
print(f"USER ADDON: {user_addon_directory}")
print(f"USER ADDON: {user_addon_directory}")
print(f"USER ADDON: {user_addon_directory}")
print(f"USER ADDON: {user_addon_directory}")
print(f"USER ADDON: {user_addon_directory}")
print(f"USER ADDON: {user_addon_directory}")
print(f"USER ADDON: {user_addon_directory}")
if not os.path.exists(user_addon_directory):
os.makedirs(user_addon_directory)

Expand Down
8 changes: 5 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@ export function handleErrors(func: () => Promise<void>) {
try {
await func();
}
catch (err: any) {
if (err.message !== CANCEL) {
vscode.window.showErrorMessage(err.message);
catch (err) {
if (err instanceof Error) {
if (err.message !== CANCEL) {
vscode.window.showErrorMessage(err.message);
}
}
}
};
Expand Down

0 comments on commit e168567

Please sign in to comment.