diff --git a/History.md b/History.md index fe2d516..816fbfe 100644 --- a/History.md +++ b/History.md @@ -1,5 +1,9 @@ # Changelog for JAUL +1.0.4 +===== +* IO getFilePath() will try local / absolute path last. + 1.0.3 ===== * Removed .git from package. diff --git a/docs/classes/_data_.datautils.html b/docs/classes/_data_.datautils.html index 91a6e98..bd60f1d 100644 --- a/docs/classes/_data_.datautils.html +++ b/docs/classes/_data_.datautils.html @@ -110,7 +110,7 @@

Static maskString

  • @@ -155,7 +155,7 @@

    Static minifyJson

  • @@ -193,7 +193,7 @@

    Static removeFromStrin
  • @@ -232,7 +232,7 @@

    Static uuid

  • diff --git a/docs/classes/_io_.ioutils.html b/docs/classes/_io_.ioutils.html index 4741874..53a7283 100644 --- a/docs/classes/_io_.ioutils.html +++ b/docs/classes/_io_.ioutils.html @@ -110,7 +110,7 @@

    Static copyFileSync
    @@ -147,7 +147,7 @@

    Static getFilePath

    @@ -187,7 +187,7 @@

    Static mkdirRecursive

  • @@ -219,7 +219,7 @@

    Static sleep

  • diff --git a/docs/classes/_network_.networkutils.html b/docs/classes/_network_.networkutils.html index c17f05f..bc8aa0b 100644 --- a/docs/classes/_network_.networkutils.html +++ b/docs/classes/_network_.networkutils.html @@ -111,7 +111,7 @@

    Static getClientIP

  • @@ -143,7 +143,7 @@

    Static getIP

  • @@ -175,7 +175,7 @@

    Static getSingleIPv4

  • @@ -198,7 +198,7 @@

    Static getSingleIPv6

  • @@ -221,7 +221,7 @@

    Static ipInRange

  • diff --git a/docs/classes/_system_.systemutils.html b/docs/classes/_system_.systemutils.html index 7f70643..f2e6697 100644 --- a/docs/classes/_system_.systemutils.html +++ b/docs/classes/_system_.systemutils.html @@ -108,7 +108,7 @@

    Static getCpuLoad

  • @@ -131,7 +131,7 @@

    Static getInfo

  • diff --git a/docs/interfaces/_system_.cpuload.html b/docs/interfaces/_system_.cpuload.html index f31937c..85caefc 100644 --- a/docs/interfaces/_system_.cpuload.html +++ b/docs/interfaces/_system_.cpuload.html @@ -104,7 +104,7 @@

    idle

    idle: number
    @@ -119,7 +119,7 @@

    total

    total: number
    diff --git a/docs/interfaces/_system_.getinfooptions.html b/docs/interfaces/_system_.getinfooptions.html index f3fd876..5413b14 100644 --- a/docs/interfaces/_system_.getinfooptions.html +++ b/docs/interfaces/_system_.getinfooptions.html @@ -103,7 +103,7 @@

    labels

    labels: boolean
    diff --git a/docs/interfaces/_system_.systemmetrics.html b/docs/interfaces/_system_.systemmetrics.html index 08ba697..cb0b832 100644 --- a/docs/interfaces/_system_.systemmetrics.html +++ b/docs/interfaces/_system_.systemmetrics.html @@ -111,7 +111,7 @@

    cpuCores

    cpuCores: number
    @@ -126,7 +126,7 @@

    hostname

    hostname: string
    @@ -141,7 +141,7 @@

    loadAvg

    loadAvg: any
    @@ -156,7 +156,7 @@

    memoryTotal

    memoryTotal: any
    @@ -171,7 +171,7 @@

    memoryUsage

    memoryUsage: any
    @@ -186,7 +186,7 @@

    platform

    platform: string
    @@ -201,7 +201,7 @@

    process

    process: any
    @@ -216,7 +216,7 @@

    title

    title: string
    @@ -231,7 +231,7 @@

    uptime

    uptime: string
    diff --git a/docs/modules/_index_.html b/docs/modules/_index_.html index 0fda229..3076b4a 100644 --- a/docs/modules/_index_.html +++ b/docs/modules/_index_.html @@ -85,7 +85,7 @@

    Let index: object

    @@ -99,7 +99,7 @@

    data

    data: any = require("./data")
    @@ -114,7 +114,7 @@

    io

    io: any = require("./io")
    @@ -129,7 +129,7 @@

    network

    network: any = require("./network")
    @@ -144,7 +144,7 @@

    system

    system: any = require("./system")
    @@ -159,7 +159,7 @@

    version

    version: any = version
    diff --git a/lib/io.js b/lib/io.js index ed128ab..41f474c 100644 --- a/lib/io.js +++ b/lib/io.js @@ -21,15 +21,11 @@ class IOUtils { if (basepath) { filename = path.resolve(basepath, originalFilename); hasFile = fs.existsSync(filename); + /* istanbul ignore else */ if (hasFile) { return filename; } } - // Check if correct full path was passed. - hasFile = fs.existsSync(filename); - if (hasFile) { - return filename; - } // Try running directory. filename = path.resolve(process.cwd(), originalFilename); hasFile = fs.existsSync(filename); @@ -40,6 +36,12 @@ class IOUtils { // Try application root path. filename = path.resolve(path.dirname(require.main.filename), originalFilename); hasFile = fs.existsSync(filename); + /* istanbul ignore if */ + if (hasFile) { + return filename; + } + // Try local / absolute path. + hasFile = fs.existsSync(filename); if (hasFile) { return filename; } diff --git a/package-lock.json b/package-lock.json index c97637b..dc84b14 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "jaul", - "version": "1.0.3", + "version": "1.0.4", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -170,9 +170,9 @@ "dev": true }, "@types/lodash": { - "version": "4.14.134", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.134.tgz", - "integrity": "sha512-2/O0khFUCFeDlbi7sZ7ZFRCcT812fAeOLm7Ev4KbwASkZ575TDrDcY7YyaoHdTOzKcNbfiwLYZqPmoC4wadrsw==", + "version": "4.14.135", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.135.tgz", + "integrity": "sha512-Ed+tSZ9qM1oYpi5kzdsBuOzcAIn1wDW+e8TFJ50IMJMlSopGdJgKAbhHzN6h1E1OfjlGOr2JepzEWtg9NIfoNg==", "dev": true }, "@types/marked": { diff --git a/package.json b/package.json index 0a84893..2f45dd1 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaul", - "version": "1.0.3", + "version": "1.0.4", "description": "Just another utilities library. But a good one.", "keywords": [ "jaul",