Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Bump winattr to @aminya/[email protected] #336

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"serializable": "^1.0.3",
"superstring": "^2.4.4",
"underscore-plus": "^1.0.0",
"winattr": "^3.0.0"
"winattr": "npm:@aminya/winattr@^4.0.3"
},
"standard": {
"env": {
Expand Down
16 changes: 1 addition & 15 deletions src/text-buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1931,7 +1931,7 @@ class TextBuffer {

const isWindows = process.platform === 'win32'
if (isWindows) {
const winattr = getPromisifiedWinattr()
const winattr = require('winattr')
const attrs = await winattr.get(filePath)
if (!attrs.hidden) throw error

Expand Down Expand Up @@ -2613,18 +2613,4 @@ class SearchCallbackArgument {
}
}

let _winattr = null
const getPromisifiedWinattr = function () {
if (_winattr === null) {
const { promisify } = require('util')
const winattr = require('winattr')
_winattr = {
set: promisify(winattr.set),
get: promisify(winattr.get)
}
}

return _winattr
}

module.exports = TextBuffer