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

Lines changed: 4 additions & 4 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy