Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating FileCopy to check for $ variables in path #660

Merged
merged 3 commits into from
Dec 13, 2024

Conversation

isc-jlechtne
Copy link
Collaborator

No description provided.

Copy link
Contributor

@isc-tleavitt isc-tleavitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs changelog.md; also, it's valid to use ${ or {$ so should probably support both.

@@ -39,7 +39,12 @@ Method OnBeforePhase(pPhase As %String, ByRef pParams) As %Status
}

If (pPhase = "Activate") && (..InstallDirectory '= "") && ('..Defer) {
Set tSource = ..ResourceReference.Module.Root _ $Case(..SourceDirectory, "": ..ResourceReference.Name,: ..SourceDirectory)
if ($Extract(..ResourceReference.Attributes.GetAt("SourceDirectory"), 0, 2) = "{$") {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isc-jlechtne Please add a comment to explain what's going on here for the sake of future me who will have forgotten.

@@ -39,7 +39,12 @@ Method OnBeforePhase(pPhase As %String, ByRef pParams) As %Status
}

If (pPhase = "Activate") && (..InstallDirectory '= "") && ('..Defer) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isc-jlechtne, it seems like everything in this if statement and the one below is identical. Perhaps that can be separated out into a helper method that cleans up the source directory, sets the target, and runs DoCopy(...) iff the phase is Activate and the Installer directory is not empty.

Or at least, break out the logic to clean up the source directory?

@@ -121,7 +132,21 @@ Method NormalizeNames(ByRef pSource As %String, ByRef pTarget As %String, Output
}
}

Method DoCopy(tSource, tTarget, pParams)
Method GetSource()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isc-jlechtne
Nit: I'd name this GetNormalizedSourcePath.
Also, it's worth adding one line of method documentation to explain that this prefixes the path to the module root if no $ variables are used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@isc-eneil I don't want to name it Normalized since the normalization actually happens in the DoCopy method. My comment inside the method is kind of the inverse of what you're saying but changing it to a method description instead as you suggested does make sense.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fair. I'm good with GetSource then.

@isc-jlechtne isc-jlechtne merged commit c2df920 into v0.9.x Dec 13, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants