From 214851e27a3fc5969ff2a091f7136d0c5b2141ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Dalmolin?= Date: Sat, 5 Mar 2022 22:36:43 -0300 Subject: [PATCH] Using the new Laravel 9 path --- all.js | 7 ++++++- json.js | 6 +++++- php.js | 6 +++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/all.js b/all.js index 71759cc..d38feea 100644 --- a/all.js +++ b/all.js @@ -1,3 +1,4 @@ +const fs = require('fs'); const _ = require('lodash'); const path = require('path'); const phpLoader = require('./php-loader'); @@ -14,7 +15,11 @@ module.exports = function (indexContent) { } catch (e) { } if (path.dirname(this.resource).includes(path.dirname(loaderPath))) { - baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'resources' + path.sep + 'lang'; + baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'lang'; + + if (! fs.existsSync(baseDirectory)) { + baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'resources' + path.sep + 'lang'; + } } else { baseDirectory = path.dirname(this.resource); } diff --git a/json.js b/json.js index efe9cd5..fb66da7 100644 --- a/json.js +++ b/json.js @@ -13,7 +13,11 @@ module.exports = function (indexContent) { } catch (e) { } if (path.dirname(this.resource).includes(path.dirname(loaderPath))) { - baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'resources' + path.sep + 'lang'; + baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'lang'; + + if (! fs.existsSync(baseDirectory)) { + baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'resources' + path.sep + 'lang'; + } } else { baseDirectory = path.dirname(this.resource); } diff --git a/php.js b/php.js index 6bd522d..1c52add 100644 --- a/php.js +++ b/php.js @@ -14,7 +14,11 @@ module.exports = function (indexContent) { } catch (e) { } if (path.dirname(this.resource).includes(path.dirname(loaderPath))) { - baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'resources' + path.sep + 'lang'; + baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'lang'; + + if (! fs.existsSync(baseDirectory)) { + baseDirectory = path.dirname(this.resource) + path.sep + '..' + path.sep + '..' + path.sep + '..' + path.sep + 'resources' + path.sep + 'lang'; + } } else { baseDirectory = path.dirname(this.resource); }