Skip to content

Commit a6741fd

Browse files
author
Mohamed Seleem
committed
Fix returning empty string if the path passed to filename.dirname/1 is a path to a file in the root directory
1 parent a9eae95 commit a6741fd

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/javascript/lib/core/erlang_compat/filename.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function join(arg, extra = null) {
1616
function dirname(arg) {
1717
const path = join([arg]);
1818
const index = path.lastIndexOf('/');
19-
return index == -1 ? '.' : path.substr(0, index);
19+
return index == -1 ? '.' : path.substr(0, index) || '/';
2020
}
2121

2222
export default {

0 commit comments

Comments
 (0)