diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-04-25 14:44:49 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-04-25 14:44:49 +0200 |
commit | 4552ccd7d76a1bf958481e24a695dd3b68e6c232 (patch) | |
tree | d96ca1329846062007700b6a28d696f0f10f9e18 /lib/utils | |
parent | 525bcd8295f72ffa09d485f86c7adea2187cde55 (diff) | |
download | gitbook-4552ccd7d76a1bf958481e24a695dd3b68e6c232.zip gitbook-4552ccd7d76a1bf958481e24a695dd3b68e6c232.tar.gz gitbook-4552ccd7d76a1bf958481e24a695dd3b68e6c232.tar.bz2 |
Add loader for themes
Diffstat (limited to 'lib/utils')
-rw-r--r-- | lib/utils/path.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/utils/path.js b/lib/utils/path.js index c233c92..a4968c8 100644 --- a/lib/utils/path.js +++ b/lib/utils/path.js @@ -42,7 +42,7 @@ function resolveInRoot(root) { return result; } -// Chnage extension +// Chnage extension of a file function setExtension(filename, ext) { return path.join( path.dirname(filename), @@ -50,9 +50,20 @@ function setExtension(filename, ext) { ); } +/* + Return true if a filename is relative. + + @param {String} + @return {Boolean} +*/ +function isPureRelative(filename) { + return (filename.indexOf('./') === 0 || filename.indexOf('../') === 0); +} + module.exports = { isInRoot: isInRoot, resolveInRoot: resolveInRoot, normalize: normalizePath, - setExtension: setExtension + setExtension: setExtension, + isPureRelative: isPureRelative }; |