added resetIconCache function

This commit is contained in:
ch1p_ 2018-12-16 16:11:27 +03:00
parent a586acf8a4
commit d8846b3c51
4 changed files with 10 additions and 2 deletions

View File

@ -263,11 +263,16 @@ void isUserAdmin(const v8::FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(Boolean::New(isolate, _isUserAdmin())); args.GetReturnValue().Set(Boolean::New(isolate, _isUserAdmin()));
} }
void resetIconCache(const v8::FunctionCallbackInfo<Value>& args) {
SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, NULL, NULL);
}
void Init(Handle<Object> exports) { void Init(Handle<Object> exports) {
NODE_SET_METHOD(exports, "deelevate", deelevate); NODE_SET_METHOD(exports, "deelevate", deelevate);
NODE_SET_METHOD(exports, "elevate", elevate); NODE_SET_METHOD(exports, "elevate", elevate);
NODE_SET_METHOD(exports, "getSystem32Path", GetSystem32Path); NODE_SET_METHOD(exports, "getSystem32Path", GetSystem32Path);
NODE_SET_METHOD(exports, "isUserAdmin", isUserAdmin); NODE_SET_METHOD(exports, "isUserAdmin", isUserAdmin);
NODE_SET_METHOD(exports, "resetIconCache", resetIconCache);
} }
NODE_MODULE(winutils, Init) NODE_MODULE(winutils, Init)

View File

@ -11,5 +11,6 @@ module.exports = {
deelevate: bin.deelevate, deelevate: bin.deelevate,
elevate: bin.elevate, elevate: bin.elevate,
getSystem32Path: bin.getSystem32Path, getSystem32Path: bin.getSystem32Path,
isUserAdmin: bin.isUserAdmin isUserAdmin: bin.isUserAdmin,
resetIconCache: bin.resetIconCache,
} }

View File

@ -2,7 +2,7 @@
"gypfile": true, "gypfile": true,
"main": "index.js", "main": "index.js",
"name": "winutils", "name": "winutils",
"version": "1.0.0", "version": "1.0.1",
"scripts": { "scripts": {
"install": "node-gyp rebuild || true", "install": "node-gyp rebuild || true",
"test": "node index.js" "test": "node index.js"

2
test.js Normal file
View File

@ -0,0 +1,2 @@
const winutils = require('./index.js')
winutils.resetIconCache()