-
Notifications
You must be signed in to change notification settings - Fork 84
Patch subfolder regex to support hyphens #1389
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ function getPackageName(filePath, amentExecuted) { | |
| } | ||
|
|
||
| if (amentExecuted) { | ||
| return filePath.match(/\w+\/share\/(\w+)\//)[1]; | ||
| return filePath.match(/[^/]+\/share\/([^/]+)\//)[1]; | ||
| } | ||
|
|
||
| let folders = path.parse(filePath).dir.split('/'); | ||
|
|
@@ -52,7 +52,7 @@ function getSubFolder(filePath, amentExecuted) { | |
| } | ||
|
|
||
| if (amentExecuted) { | ||
| return filePath.match(/\w+\/share\/\w+\/(\w+)\//)[1]; | ||
| return filePath.match(/[^/]+\/share\/[^/]+\/([^/]+)\//)[1]; | ||
| } | ||
|
Comment on lines
54
to
56
|
||
| // If the |amentExecuted| equals to false, the file's extension will be assigned as | ||
| // the name of sub folder. | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ament path parsing regex is duplicated between
getPackageNameandgetSubFolder. Consider centralizing the parsing (e.g., split on/share/and then on/) to reduce the chance of future divergence when path rules change again.