fix: bridge long CAD project paths and normalize COM path getters
This commit is contained in:
1 parent
e655797e32
commit
ff06f86f62
9 files changed
+242
-10
No files matched your search
@@ -35,6 +35,7 @@ Dim QP_NcSyncSummary
|
||||
Dim QP_SessionMode, QP_SessionToken, QP_SessionProject, QP_MonitorJobId
|
||||
Dim QP_OwnedProjectPath, QP_SessionWaiting, QP_SessionExternalChange
|
||||
Dim QP_CheckpointSchematic, QP_CheckpointSheet
|
||||
Dim QP_ProjectAccess, QP_AccessProject
|
||||
Dim FailureState, CloseError
|
||||
Set QP_Fso = CreateObject("Scripting.FileSystemObject")
|
||||
QP_RootTemplate = "%LOCALAPPDATA%\DxProductivity\trial-task-center\quick-run"
|
||||
@@ -520,6 +521,7 @@ Function QPConfirmedProjectPath()
|
||||
Err.Raise vbObjectError + 850, "QuickPartReplace.Session", "confirmed sheet columns are incomplete"
|
||||
If (Len(QP_TargetSchematic) = 0) <> (Len(QP_TargetSheet) = 0) Then _
|
||||
Err.Raise vbObjectError + 850, "QuickPartReplace.Session", "confirmed sheet identity is incomplete"
|
||||
TargetPath = QPProjectAccessPath(TargetPath)
|
||||
If Not QP_Fso.FileExists(TargetPath) Then _
|
||||
Err.Raise vbObjectError + 850, "QuickPartReplace.Session", "confirmed project file does not exist: " & TargetPath
|
||||
If LCase(QP_Fso.GetExtensionName(TargetPath)) <> "prj" Then _
|
||||
@@ -2498,7 +2500,7 @@ Function QPProjectPath()
|
||||
If Len(Trim(ProjectPath)) = 0 Then
|
||||
Err.Raise vbObjectError + 827, "QuickPartReplace", "no active project"
|
||||
End If
|
||||
QPProjectPath = ProjectPath
|
||||
QPProjectPath = QPCanonicalPath(ProjectPath)
|
||||
End Function
|
||||
|
||||
Function QPSheetIdentity()
|
||||
@@ -2929,8 +2931,49 @@ Function QPDecode(ByVal Value)
|
||||
End Function
|
||||
|
||||
Function QPCanonicalPath(ByVal Value)
|
||||
QPCanonicalPath = LCase(Replace(QP_Fso.GetAbsolutePathName(CStr(Value)), _
|
||||
"/", "\"))
|
||||
Dim Identity
|
||||
QPEnsureProjectAccess
|
||||
Identity = LCase(Replace(QP_Fso.GetAbsolutePathName(CStr(Value)), "/", "\"))
|
||||
If QP_AccessProject.Exists(Identity) Then Identity = QP_AccessProject(Identity)
|
||||
QPCanonicalPath = Identity
|
||||
End Function
|
||||
|
||||
Sub QPEnsureProjectAccess()
|
||||
Dim Path, Lines, Fields, Index, Canonical, Access
|
||||
If IsObject(QP_ProjectAccess) Then Exit Sub
|
||||
Set QP_ProjectAccess = CreateObject("Scripting.Dictionary")
|
||||
Set QP_AccessProject = CreateObject("Scripting.Dictionary")
|
||||
QP_ProjectAccess.CompareMode = 1
|
||||
QP_AccessProject.CompareMode = 1
|
||||
Path = QP_Fso.BuildPath(QP_Root, "project-access.tsv")
|
||||
If Not QP_Fso.FileExists(Path) Then Exit Sub
|
||||
Lines = Split(QPReadUtf8(Path), vbLf)
|
||||
If Replace(Lines(0), vbCr, "") <> "project_path" & vbTab & "access_path" Then _
|
||||
Err.Raise vbObjectError + 874, "QuickPartReplace.ProjectAccess", "invalid project access header"
|
||||
For Index = 1 To UBound(Lines)
|
||||
If Len(Replace(Lines(Index), vbCr, "")) > 0 Then
|
||||
Fields = Split(Replace(Lines(Index), vbCr, ""), vbTab)
|
||||
If UBound(Fields) <> 1 Then _
|
||||
Err.Raise vbObjectError + 874, "QuickPartReplace.ProjectAccess", "invalid project access row"
|
||||
Canonical = LCase(Replace(QP_Fso.GetAbsolutePathName(Fields(0)), "/", "\"))
|
||||
Access = LCase(Replace(QP_Fso.GetAbsolutePathName(Fields(1)), "/", "\"))
|
||||
If QP_ProjectAccess.Exists(Canonical) Or QP_AccessProject.Exists(Access) Then _
|
||||
Err.Raise vbObjectError + 874, "QuickPartReplace.ProjectAccess", "duplicate project access identity"
|
||||
QP_ProjectAccess.Add Canonical, Fields(1)
|
||||
QP_AccessProject.Add Access, Canonical
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
Function QPProjectAccessPath(ByVal Value)
|
||||
Dim Identity
|
||||
QPEnsureProjectAccess
|
||||
Identity = LCase(Replace(QP_Fso.GetAbsolutePathName(CStr(Value)), "/", "\"))
|
||||
If QP_ProjectAccess.Exists(Identity) Then
|
||||
QPProjectAccessPath = QP_ProjectAccess(Identity)
|
||||
Else
|
||||
QPProjectAccessPath = Value
|
||||
End If
|
||||
End Function
|
||||
|
||||
Sub QPRaiseCaptured(ByVal Number, ByVal Source, ByVal Description, ByVal Fallback)
|
||||
|
||||
Reference in new issue
Block a user