0
0
Fork 0

fix(scripts): raw-string PROJECT_FILE_PATH in new device tools

The scan_network_devices, verify_device_reachable, and
rebind_device_to_scan templates used plain "..." strings for
PROJECT_FILE_PATH. With a UNC path like \\files\... the rendered Python
source had "\\files\..." which Python's source parser collapses to
"\files\..." (one backslash). ensure_project_open then saw the mangled
path as different from the (correctly-opened) primary, CLOSED the
primary project, and failed to reopen the corrupted path.

Other scripts use r"..." to bypass source-level escaping. Applying the
same to the three new ones.

Also bumps to 0.9.5.
This commit is contained in:
Karstein Phobic Nyvold Kvistad 2026-05-11 17:27:15 +02:00
parent 50b8b5763b
commit 1feb76d009
5 changed files with 9 additions and 9 deletions

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "codesys-mcp-sp21-plus",
"version": "0.9.4",
"version": "0.9.5",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "codesys-mcp-sp21-plus",
"version": "0.9.4",
"version": "0.9.5",
"license": "MIT",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.26.0",

View file

@ -1,6 +1,6 @@
{
"name": "codesys-mcp-sp21-plus",
"version": "0.9.4",
"version": "0.9.5",
"description": "Codesys-MCP-SP21+ -- fork of luke-harriman/Codesys-MCP carrying CODESYS V3.5 SP22 Patch 1 fixes (and forward-compat with later SPs): script-engine API drift, online/runtime tool auto-login, dual-SHA release classifier, set_pou_code omitted-decl wipe fix, add_library managed-overload, etc. MCP server for CODESYS with persistent UI instance and file-based IPC.",
"main": "dist/server.js",
"bin": {

View file

@ -14,10 +14,10 @@
import sys, scriptengine as script_engine, os, traceback, json
PROJECT_FILE_PATH = "{PROJECT_FILE_PATH}"
MATCH_NAME = "{MATCH_NAME}" # optional override
MATCH_DEVICE_ID = "{MATCH_DEVICE_ID}" # optional override
MATCH_ADDRESS = "{MATCH_ADDRESS}" # optional override -- skip scan match
PROJECT_FILE_PATH = r"{PROJECT_FILE_PATH}"
MATCH_NAME = r"{MATCH_NAME}" # optional override
MATCH_DEVICE_ID = r"{MATCH_DEVICE_ID}" # optional override
MATCH_ADDRESS = r"{MATCH_ADDRESS}" # optional override -- skip scan match
def _find_gateway(target_device):

View file

@ -18,7 +18,7 @@
import sys, scriptengine as script_engine, os, traceback, json
PROJECT_FILE_PATH = "{PROJECT_FILE_PATH}"
PROJECT_FILE_PATH = r"{PROJECT_FILE_PATH}"
USE_CACHE = "{USE_CACHE}" == '1'

View file

@ -13,7 +13,7 @@
import sys, scriptengine as script_engine, os, traceback, json
PROJECT_FILE_PATH = "{PROJECT_FILE_PATH}"
PROJECT_FILE_PATH = r"{PROJECT_FILE_PATH}"
def _find_gateway(target_device):