scholarsmate commented on code in PR #706:
URL: https://github.com/apache/daffodil-vscode/pull/706#discussion_r1271053995
##########
src/adapter/activateDaffodilDebug.ts:
##########
@@ -52,7 +52,18 @@ async function getFile(fileRequested, label, title) {
})
.then((fileUri) => {
if (fileUri && fileUri[0]) {
- return fileUri[0].fsPath
+ let path = fileUri[0].fsPath
+
+ if (
+ process.platform === 'win32' &&
+ path.charCodeAt(0) > 97 &&
+ path.charCodeAt(0) <= 122 &&
+ path.charAt(1) === ':'
Review Comment:
That if statement is nested in another if statement (line 54), so you won't
get an NPE. It might be a good idea to ensure that the length of the path is
greater than 2 before peeking at different indexes (e.g, `charCodeAt(0)` and
`charAt(1)`) without knowing the size of the path. I instinctively look at
those fail fast conditionals with what filters things the quickest and order
those first. If the second character is not a colon, then it saves you from
the next 2 checks.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]