Skip to content

Commit 13969a1

Browse files
authored
Merge pull request #54 from arduino/chore/refactor-get-path
Using `path.posix` instead of string manipulation
2 parents db8a85f + 9a40941 commit 13969a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

preload.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ const Serial = {
7474
return board.exit_raw_repl()
7575
},
7676
getNavigationPath: (navigation, target) => {
77-
return [navigation, target].filter(p => p).join('/')
77+
return path.posix.join(navigation, target)
7878
},
7979
getFullPath: (root, navigation, file) => {
80-
return root + [navigation, file].filter(p => p).join('/')
80+
return path.posix.join(root, navigation, file)
8181
},
82-
getParentPath: (filePath) => {
83-
return filePath.split('/').slice(0, -1).join('/')
82+
getParentPath: (navigation) => {
83+
return path.posix.dirname(navigation)
8484
}
8585
}
8686

0 commit comments

Comments
 (0)