Skip to content

Commit 2b628fb

Browse files
committed
Update to version 1.0.2
- Fixed wrong path used, that could lead to autocompletion or debugging not working - Fixed an update issue on VS Code side once a script was send by Cinema 4D to Vs Code unsaved change where not sent.
1 parent 3ef2515 commit 2b628fb

File tree

3 files changed

+23
-6
lines changed

3 files changed

+23
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"icon": "image/maxon_logo.png",
66
"displayName": "Cinema 4D Connector",
77
"description": "Provides helper tool to developer Cinema 4D scripts and plugins.",
8-
"version": "1.0.1",
8+
"version": "1.0.2",
99
"repository": {
1010
"type": "git",
1111
"url": "https://github.com/PluginCafe/Cinema4D_Connector-VisualStudioCode_Extension"

src/commands.ts

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,27 @@ export async function DebugScriptContentInScriptManager()
121121
{ throw new Error("Unable to retrieve Cinema 4D path"); }
122122

123123
let pythonPath = os.platform() === 'win32'?
124-
path.posix.join(c4dPath, "resource", "modules", "python", "libs", "python39.win64.framework", "python.exe")
124+
path.join(c4dPath, "resource", "modules", "python", "libs", "python39.win64.framework", "python.exe")
125125
:
126-
path.posix.join(c4dPath, "resource", "modules", "python", "libs", "python39.macos.framework", "python", "Contents", "MacOS", "python")
126+
path.join(c4dPath, "resource", "modules", "python", "libs", "python39.macos.framework", "python", "Contents", "MacOS", "python")
127127
;
128+
129+
if (!fs.existsSync(pythonPath))
130+
{ pythonPath = os.platform() === 'win32'?
131+
path.join(c4dPath, "resource", "modules", "python", "libs", "python310.win64.framework", "python.exe")
132+
:
133+
path.join(c4dPath, "resource", "modules", "python", "libs", "python310.macos.framework", "python", "Contents", "MacOS", "python")
134+
;}
135+
136+
if (!fs.existsSync(pythonPath))
137+
{ throw new Error("Incorrect path for the c4d python executable, debugger will not work."); }
128138

129-
let debugAdapterPath = path.posix.join(c4dPath!, "resource", "modules", "python", "libs", "python39", "debugpy", "adapter");
139+
let debugAdapterPath = path.join(c4dPath!, "resource", "modules", "python", "libs", "python39", "debugpy", "adapter");
140+
if (!fs.existsSync(debugAdapterPath))
141+
{ debugAdapterPath = path.join(c4dPath!, "resource", "modules", "python", "libs", "python310", "debugpy", "adapter"); }
142+
143+
if (!fs.existsSync(pythonPath))
144+
{ throw new Error("Incorrect path for the debugpy, debugger will not work."); }
130145

131146
let configName = `Python attached to Cinema 4D - PID ${pid}`;
132147
let configuration: vscode.DebugConfiguration =
@@ -169,7 +184,7 @@ export async function LoadTemplateScript()
169184

170185
fs.readdirSync(templatePath).forEach(fileName =>
171186
{
172-
let file = path.posix.join(templatePath, fileName);
187+
let file = path.join(templatePath, fileName);
173188
if (fileName.endsWith(".py"))
174189
{
175190
fileNames.push(new FileItem(file));

src/settings.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ function setPythonExtraPath(inputPath?: string)
5959

6060
let pathToAdd = path.join(c4dPath, "resource", "modules", "python", "libs", "python39");
6161
if (!fs.existsSync(pathToAdd))
62+
{ pathToAdd = path.join(c4dPath, "resource", "modules", "python", "libs", "python310"); }
63+
if (!fs.existsSync(pathToAdd))
6264
{ throw new Error("Incorrect path for c4d.path, autocompletion will not work"); }
6365

6466
let pathToAddC4D = path.join(pathToAdd, "c4d");
@@ -166,7 +168,7 @@ export function GetAndStoreTemplateDir()
166168
let extension = vscode.extensions.getExtension("maxonc4dsdk.cinema4d-connector");
167169
assert(extension !== undefined);
168170

169-
templatePath = path.posix.join(extension.extensionPath, "script_template");
171+
templatePath = path.join(extension.extensionPath, "script_template");
170172
if (!templatePath || !fs.existsSync(templatePath))
171173
{
172174
throw new Error("Can't compute script template.");

0 commit comments

Comments
 (0)