Skip to content

Instantly share code, notes, and snippets.

@thorwe
Last active October 12, 2015 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thorwe/a04340f0a3519659f248 to your computer and use it in GitHub Desktop.
Save thorwe/a04340f0a3519659f248 to your computer and use it in GitHub Desktop.
Get Overwolf App Directory (using IO Plugin)
// add 'Extensions' to manifest permission object
// have one of the two IO Plugins available as pluginIO
var getMyWebAppDirectory = function(callback) {
var mypath = pluginIO().LOCALAPPDATA + "\\Overwolf\\Extensions";
var fallback = function() {
var pluginStr = window.location.host;
pluginStr = pluginStr.replace("Window_Extension_", "");
var index = pluginStr.lastIndexOf("_");
if (index != -1) {
pluginStr = pluginStr.slice(0,index);
}
mypath += "\\" + pluginStr + "\\" + "1.0.0";
}
overwolf.extensions.current.getManifest(function(manifestObj) {
if (typeof manifestObj === "undefined") {
console.error("Could not get Manifest.");
fallback();
} else if (typeof manifestObj.UID === "undefined") {
console.error("Manifest has no UID.");
fallback();
} else if (typeof manifestObj.meta === "undefined") {
console.error("Manifest has no meta object.");
fallback();
} else {
mypath += "\\" + manifestObj.UID + "\\" + manifestObj.meta.version;
}
pluginIO().isDirectory(
mypath,
function(status) {
callback(mypath, status);
}
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment