diff --git a/bin/lint b/bin/lint index c5fbfd6..d8626c5 100755 --- a/bin/lint +++ b/bin/lint @@ -2,8 +2,20 @@ set -e -BINDIR=$(dirname $0) -SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('$0')"))) +dirname --help +echo $0 +echo $(dirname "$0") +TEST="${$0/\\/"\\\\"}" +TEST2="${$0/\\/"/"}" +echo $TEST +echo $TEST2 +echo $(node -pe "'$0'.replace('\\\\', '/')") +echo $(node -pe "'$TEST'") +echo $(node -pe "'$TEST'.replace('\\\\', '/')") +echo $(node -pe "require('fs').realpathSync('$0').replace('\\\\', '/')") + +BINDIR=$(dirname "$0") +SRCDIR=$(dirname $(dirname $(node -pe "require('fs').realpathSync('$0'.replace('\\\\', '/'))"))) while (( $# )); do case "$1" in diff --git a/scripts/modify-ignore.js b/scripts/modify-ignore.js index 4369684..a48565a 100644 --- a/scripts/modify-ignore.js +++ b/scripts/modify-ignore.js @@ -1,4 +1,5 @@ -const {readFileSync, writeFileSync} = require('fs'); +const {join} = require('node:path'); +const {readFileSync, writeFileSync} = require('node:fs'); const SYSTEM = [ '.idea', @@ -49,7 +50,7 @@ const ignores = { }; for (const [file, list] of Object.entries(ignores)) { - const filename = process.cwd() + '/' + file; + const filename = join(process.cwd(), file); let source; try { diff --git a/scripts/modify-package.js b/scripts/modify-package.js index 862ef4e..6a64825 100644 --- a/scripts/modify-package.js +++ b/scripts/modify-package.js @@ -1,5 +1,7 @@ -const filename = process.cwd() + '/package.json'; -const {readFileSync, writeFileSync} = require('fs'); +const {join} = require('node:path'); +const {readFileSync, writeFileSync} = require('node:fs'); + +const filename = join(process.cwd(), 'package.json'); let pkg; try {