mirror of
https://github.com/alicevision/Meshroom.git
synced 2025-07-19 17:47:25 +02:00
[ui] move filepath.js to Utils module
This commit is contained in:
parent
61427ba41c
commit
d91601ca8e
6 changed files with 5 additions and 4 deletions
|
@ -1,24 +0,0 @@
|
|||
/* Utility functions to manipulate file paths */
|
||||
|
||||
/// Returns the directory name of the given path.
|
||||
function dirname(path) {
|
||||
return path.substring(0, path.lastIndexOf('/'))
|
||||
}
|
||||
|
||||
/// Returns the basename (file.extension) of the given path.
|
||||
function basename(path) {
|
||||
return path.substring(path.lastIndexOf('/') + 1, path.length)
|
||||
}
|
||||
|
||||
/// Return the extension (prefixed by a '.') of the given path.
|
||||
function extension(path) {
|
||||
var dot_pos = path.lastIndexOf('.');
|
||||
return dot_pos > -1 ? path.substring(dot_pos, path.length) : ""
|
||||
}
|
||||
|
||||
/// Return whether the given path is a path to a file.
|
||||
/// (only based on the fact that the last portion of the path
|
||||
/// matches the 'basename.extension' pattern)
|
||||
function isFile(path) {
|
||||
return extension(path) !== ""
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue